Skip to content

Commit cdf419a

Browse files
added rm command and tests (#3)
* added rm command and tests * Renamed vcstool to vcstool2
1 parent cf687f3 commit cdf419a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+322
-137
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: vcstool
1+
name: vcstool2
22

33
on:
44
push:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
build
33
deb_dist
44
dist
5-
vcstool.egg-info
5+
vcstool2.egg-info

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include vcstool-completion/vcs.bash vcstool-completion/vcs.tcsh vcstool-completion/vcs.zsh
2-
include vcstool-completion/vcs.fish
1+
include vcstool2-completion/vcs.bash vcstool2-completion/vcs.tcsh vcstool2-completion/vcs.zsh
2+
include vcstool2-completion/vcs.fish
33
include test/*.repos
44
include test/*.txt

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: all setup clean_dist distro clean install
22

3-
NAME=vcstool
3+
NAME=vcstool2
44
VERSION=`./setup.py --version`
55

66
all:
@@ -12,7 +12,7 @@ setup:
1212
clean_dist:
1313
-rm -rf deb_dist
1414
-rm -rf dist
15-
-rm -rf vcstool.egg-info
15+
-rm -rf vcstool2.egg-info
1616

1717
distro: setup clean_dist
1818
python setup.py sdist

README.md

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ these dictionaries contains keys `url`, and `version`. If the `version` key is o
5555
being used.
5656

5757
This results in something similar to the following for a set of two repositories
58-
([vcstool](https://github.com/dirk-thomas/vcstool) cloned via Git and
59-
[rosinstall](http://github.com/vcstools/rosinstall) checked out via Subversion):
58+
([vcstool](https://github.com/dirk-thomas/vcstool) and
59+
[vcstool2](https://github.com/MaxandreOgeret/vcstool2)):
6060

6161
``` yaml
6262
repositories:
6363
vcstool:
6464
url: git@github.com:dirk-thomas/vcstool.git
6565
version: master
6666
old_tools/rosinstall:
67-
url: https://github.com/vcstools/rosinstall/trunk
68-
version: 748
67+
url: git@github.com:MaxandreOgeret/vcstool2.git
68+
version: master
6969
```
7070
7171
### Export set of repositories
@@ -104,11 +104,32 @@ The `vcs validate` command takes a YAML file which is passed in via `stdin` and
104104
data of a previously-exported file or hand-generated file are piped in:
105105

106106
```bash
107-
vcs validate < my.repos
107+
vcs validate < my.repos
108+
```
109+
110+
### Deleting repositories
111+
112+
The `vcs rm` command takes a YAML file containing the repositories which is passed in via `stdin` or with its path
113+
specified via `--input`.
114+
115+
The command performs a dry run by default, to perform the deletion use the `--force` option.
116+
117+
This command will delete all the pulled repositories if the `--all` option is passed.
118+
It can also filter the repos to delete based on their cloning path with a regex pattern passed with the `--pattern`
119+
option, see the `re` module [documentation](https://docs.python.org/3/library/re.html#regular-expression-syntax)
120+
for details about the syntax.
121+
122+
To delete all:
123+
124+
```bash
125+
vcs rm --all --force < repos.yaml
108126
```
109127

110-
The `validate` command also supports input in the
111-
[rosinstall file format](http://www.ros.org/doc/independent/api/rosinstall/html/rosinstall_file_format.html).
128+
To delete all repos paths containing "foo" or "bar":
129+
130+
```bash
131+
vcs rm --pattern "foo|bar" --force < repos.yaml
132+
```
112133

113134
## Advanced features
114135

@@ -156,25 +177,25 @@ enable that feature the shell specific completion file must be sourced.
156177
For *bash* append the following line to the `~/.bashrc` file:
157178

158179
```bash
159-
source /usr/share/vcstool-completion/vcs.bash
180+
source /usr/share/vcstool2-completion/vcs.bash
160181
```
161182

162183
For *tcsh* append the following line to the `~/.cshrc` file:
163184

164185
```bash
165-
source /usr/share/vcstool-completion/vcs.tcsh
186+
source /usr/share/vcstool2-completion/vcs.tcsh
166187
```
167188

168189
For *zsh* append the following line to the `~/.zshrc` file:
169190

170191
```bash
171-
source /usr/share/vcstool-completion/vcs.zsh
192+
source /usr/share/vcstool2-completion/vcs.zsh
172193
```
173194

174195
For *fish* append the following line to the `~/.config/fishconfig.fish` file:
175196

176197
```bash
177-
source /usr/share/vcstool-completion/vcs.fish
198+
source /usr/share/vcstool2-completion/vcs.fish
178199
```
179200

180201
# How to contribute?

publish-python.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ artifacts:
66
uploads:
77
- type: packagecloud
88
config:
9-
repository: dirk-thomas/vcstool
9+
repository: MaxandreOgeret/vcstool2
1010
distributions:
1111
- ubuntu:bionic
1212
- ubuntu:focal

scripts/vcs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.vcs import main
5+
from vcstool2.commands.vcs import main
66

77
sys.exit(main() or 0)

scripts/vcs-branch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.branch import main
5+
from vcstool2.commands.branch import main
66

77
sys.exit(main() or 0)

scripts/vcs-custom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.custom import main
5+
from vcstool2.commands.custom import main
66

77
sys.exit(main() or 0)

scripts/vcs-diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.diff import main
5+
from vcstool2.commands.diff import main
66

77
sys.exit(main() or 0)

scripts/vcs-export

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.export import main
5+
from vcstool2.commands.export import main
66

77
sys.exit(main() or 0)

scripts/vcs-help

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.help import main
5+
from vcstool2.commands.help import main
66

77
sys.exit(main() or 0)

scripts/vcs-import

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.import_ import main
5+
from vcstool2.commands.import_ import main
66

77
sys.exit(main() or 0)

scripts/vcs-log

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.log import main
5+
from vcstool2.commands.log import main
66

77
sys.exit(main() or 0)

scripts/vcs-pull

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.pull import main
5+
from vcstool2.commands.pull import main
66

77
sys.exit(main() or 0)

scripts/vcs-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.push import main
5+
from vcstool2.commands.push import main
66

77
sys.exit(main() or 0)

scripts/vcs-remotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.remotes import main
5+
from vcstool2.commands.remotes import main
66

77
sys.exit(main() or 0)

scripts/vcs-rm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
5+
from vcstool2.commands.rm import main
6+
7+
sys.exit(main() or 0)

scripts/vcs-status

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.status import main
5+
from vcstool2.commands.status import main
66

77
sys.exit(main() or 0)

scripts/vcs-validate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import sys
44

5-
from vcstool.commands.validate import main
5+
from vcstool2.commands.validate import main
66

77
sys.exit(main() or 0)

setup.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
from pathlib import Path
12
from setuptools import find_packages
23
from setuptools import setup
3-
from vcstool import __version__
4+
5+
from vcstool2 import __version__
46

57
install_requires = ['PyYAML', 'setuptools']
8+
this_directory = Path(__file__).parent
9+
long_description = (this_directory / "README.md").read_text()
610

711
setup(
812
name='vcstool2',
@@ -19,34 +23,35 @@
1923
'Programming Language :: Python',
2024
'Topic :: Software Development :: Version Control',
2125
'Topic :: Utilities'],
22-
description='vcstool provides a command line tool to invoke git commands on multiple repositories.',
23-
long_description='vcstool2 enables batch commands on multiple different git repositories. It is a fork of Dirk '
24-
'Thomas\' vcstool',
26+
description='vcstool2 provides a command line tool to invoke git commands on multiple repositories.',
27+
long_description=long_description,
28+
long_description_content_type='text/markdown',
2529
license='Apache License, Version 2.0',
2630
data_files=[
27-
('share/vcstool-completion', [
28-
'vcstool-completion/vcs.bash',
29-
'vcstool-completion/vcs.tcsh',
30-
'vcstool-completion/vcs.zsh',
31-
'vcstool-completion/vcs.fish'
31+
('share/vcstool2-completion', [
32+
'vcstool2-completion/vcs.bash',
33+
'vcstool2-completion/vcs.tcsh',
34+
'vcstool2-completion/vcs.zsh',
35+
'vcstool2-completion/vcs.fish'
3236
])
3337
],
3438
entry_points={
3539
'console_scripts': [
36-
'vcs = vcstool.commands.vcs:main',
37-
'vcs-branch = vcstool.commands.branch:main',
38-
'vcs-custom = vcstool.commands.custom:main',
39-
'vcs-diff = vcstool.commands.diff:main',
40-
'vcs-export = vcstool.commands.export:main',
41-
'vcs-git = vcstool.commands.custom:git_main',
42-
'vcs-help = vcstool.commands.help:main',
43-
'vcs-import = vcstool.commands.import_:main',
44-
'vcs-log = vcstool.commands.log:main',
45-
'vcs-pull = vcstool.commands.pull:main',
46-
'vcs-push = vcstool.commands.push:main',
47-
'vcs-remotes = vcstool.commands.remotes:main',
48-
'vcs-status = vcstool.commands.status:main',
49-
'vcs-validate = vcstool.commands.validate:main',
40+
'vcs = vcstool2.commands.vcs:main',
41+
'vcs-branch = vcstool2.commands.branch:main',
42+
'vcs-custom = vcstool2.commands.custom:main',
43+
'vcs-diff = vcstool2.commands.diff:main',
44+
'vcs-export = vcstool2.commands.export:main',
45+
'vcs-git = vcstool2.commands.custom:git_main',
46+
'vcs-help = vcstool2.commands.help:main',
47+
'vcs-import = vcstool2.commands.import_:main',
48+
'vcs-log = vcstool2.commands.log:main',
49+
'vcs-pull = vcstool2.commands.pull:main',
50+
'vcs-push = vcstool2.commands.push:main',
51+
'vcs-remotes = vcstool2.commands.remotes:main',
52+
'vcs-rm = vcstool2.commands.rm:main',
53+
'vcs-status = vcstool2.commands.status:main',
54+
'vcs-validate = vcstool2.commands.validate:main',
5055
]
5156
}
5257
)

test/commands.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
branch custom diff export import log pull push remotes status validate
1+
branch custom diff export import log pull push remotes rm status validate

0 commit comments

Comments
 (0)