Skip to content

Commit b6ffd44

Browse files
author
BuildTools
committed
Switched readme from RST ro MD
1 parent daf3893 commit b6ffd44

File tree

2 files changed

+219
-220
lines changed

2 files changed

+219
-220
lines changed

README.md

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# What is vcstool2?
2+
3+
Vcstool2 is an attempt at continuing the development of [vcstool](https://github.com/dirk-thomas/vcstool)
4+
by [Dirk Thomas](https://github.com/dirk-thomas).
5+
6+
Vcstool2 is a version control system (VCS) tool, designed to make working
7+
with multiple repositories easier.
8+
9+
Note:
10+
11+
This tool should not be confused with [vcstools](https://github.com/vcstools/vcstools/) (with a trailing`s`) which
12+
provides a Python API for interacting with different version control systems. The biggest differences between the two
13+
are:
14+
15+
- **vcstool2** doesn't use any state beside the repository working copies available in the filesystem.
16+
- The file format of vcstool2's `export` uses the relative paths of the repositories as keys in YAML which avoids
17+
collisions by design.
18+
- **vcstool2** has significantly fewer lines of code than **vcstools** including the command line tools built on top.
19+
20+
## Python support
21+
22+
This package supports python >= 3.4.
23+
24+
## How does it work?
25+
26+
Vcstool2 operates on any folder from where it recursively searches for supported repositories. On these repositories
27+
vcstool2 invokes the native VCS client with the requested command (i.e. *diff*).
28+
29+
## Which VCS types are supported?
30+
31+
Vcstool2 supports:
32+
33+
- [Git](http://git-scm.com)
34+
- [Mercurial](http://git-scm.comhttp://mercurial.selenic.com)
35+
- [Subversion](http://subversion.apache.org)
36+
- [Bazaar](http://bazaar.canonical.com/en/)
37+
38+
The support for Mercurial, Subversion and Bazaar will be dropped in the future.
39+
40+
## How to use vcstool2?
41+
42+
The script `vcs` can be used similarly to the VCS clients `git`, `hg`, etc. The `help` command provides a list of
43+
available commands with an additional description:
44+
45+
```bash
46+
vcs help
47+
```
48+
49+
By default, vcstool2 searches for repositories under the current folder. Optionally one path (or multiple paths) can be
50+
passed to search for repositories at different locations:
51+
52+
```bash
53+
vcs status /path/to/several/repos /path/to/other/repos /path/to/single/repo
54+
```
55+
56+
## Exporting and importing sets of repositories
57+
58+
Vcstool2 can export and import all the information required to reproduce the versions of a set of repositories. Vcstool2
59+
uses a simple [YAML](http://www.yaml.org/) format to encode this information. This format includes a root
60+
key `repositories` under which each local repository is described by a dictionary keyed by its relative path. Each of
61+
these dictionaries contains keys `type`, `url`, and `version`. If the `version` key is omitted the default branch is
62+
being used.
63+
64+
This results in something similar to the following for a set of two repositories
65+
([vcstool](https://github.com/dirk-thomas/vcstool) cloned via Git and
66+
[rosinstall](http://github.com/vcstools/rosinstall) checked out via Subversion):
67+
68+
``` yaml
69+
repositories:
70+
vcstool:
71+
type: git
72+
url: git@github.com:dirk-thomas/vcstool.git
73+
version: master
74+
old_tools/rosinstall:
75+
type: svn
76+
url: https://github.com/vcstools/rosinstall/trunk
77+
version: 748
78+
```
79+
80+
### Export set of repositories
81+
82+
The `vcs export` command outputs the path, vcs type, URL and version
83+
information for all repositories in [YAML](http://www.yaml.org/) format.
84+
The output is usually piped to a file:
85+
86+
```bash
87+
vcs export > my.repos
88+
```
89+
90+
If the repository is currently on the tip of a branch the branch is followed. This implies that a later import might
91+
fetch a newer revision if the branch has evolved in the meantime. Furthermore, if the local branch has evolved from the
92+
remote repository an import might not result in the exact same state.
93+
94+
To make sure to store the exact revision in the exported data use the command line argument `--exact`. Since a specific
95+
revision is not tied to neither a branch nor a remote (for Git and Mercurial) the tool will check if the current hash
96+
exists in any of the remotes. If it exists in multiple the remotes `origin` and `upstream` are considered before any
97+
other in alphabetical order.
98+
99+
### Import set of repositories
100+
101+
The `vcs import` command clones all repositories which are passed in via `stdin` in YAML format. Usually the data of a
102+
previously exported file is piped in:
103+
104+
```bash
105+
vcs import < my.repos
106+
```
107+
108+
The `import` command also supports input in the
109+
[rosinstall file format](http://www.ros.org/doc/independent/api/rosinstall/html/rosinstall_file_format.html).
110+
Beside passing a file path the command also supports passing a URL.
111+
112+
Only for this command vcstool2 supports the pseudo clients `tar` and`zip` which fetch a tarball / zipfile from a URL and
113+
unpack its content. For those two types the `version` key is optional. If specified only entries from the archive which
114+
are in the subfolder specified by the version value are being extracted.
115+
116+
### Validate repositories file
117+
118+
The `vcs validate` command takes a YAML file which is passed in via `stdin` and validates its contents and format. The
119+
data of a previously-exported file or hand-generated file are piped in:
120+
121+
```bash
122+
vcs validate < my.repos
123+
```
124+
125+
The `validate` command also supports input in the
126+
[rosinstall file format](http://www.ros.org/doc/independent/api/rosinstall/html/rosinstall_file_format.html).
127+
128+
## Advanced features
129+
130+
### Show log since last tag
131+
132+
The `vcs log` command supports the argument `--limit-untagged` which will output the log for all commits since the last
133+
tag.
134+
135+
### Parallelization and stdin
136+
137+
By default `vcs` parallelizes the work across multiple repositories based on the number of CPU cores. In the case that
138+
the invoked commands require input from `stdin` that parallelization is a problem. In order to be able to provide input
139+
to each command separately these commands must run sequentially. When needing to e.g. interactively provide credentials
140+
all commands should be executed sequentially by passing:
141+
142+
```
143+
--workers 1
144+
```
145+
146+
In the case repositories are using SSH `git@` URLs but the host is not known yet `vcs import` automatically falls back
147+
to a single worker.
148+
149+
### Run arbitrary commands
150+
151+
The `vcs custom` command enables to pass arbitrary user-specified arguments to the vcs invocation. The set of
152+
repositories to operate on can optionally be restricted by the type:
153+
154+
```
155+
vcs custom --git --args log --oneline -n 10
156+
```
157+
158+
If the command should work on multiple repositories make sure to pass only generic arguments which work for all of these
159+
repository types.
160+
161+
# How to install vcstool2?
162+
163+
Use the [PyPI](http://pypi.python.org) package:
164+
165+
```bash
166+
sudo pip install vcstool2
167+
```
168+
169+
## Setup auto-completion
170+
171+
For the shells *bash*, *tcsh* and *zsh* vcstool2 can provide auto-completion of the various VCS commands. In order to
172+
enable that feature the shell specific completion file must be sourced.
173+
174+
For *bash* append the following line to the `~/.bashrc` file:
175+
176+
```bash
177+
source /usr/share/vcstool-completion/vcs.bash
178+
```
179+
180+
For *tcsh* append the following line to the `~/.cshrc` file:
181+
182+
```bash
183+
source /usr/share/vcstool-completion/vcs.tcsh
184+
```
185+
186+
For *zsh* append the following line to the `~/.zshrc` file:
187+
188+
```bash
189+
source /usr/share/vcstool-completion/vcs.zsh
190+
```
191+
192+
For *fish* append the following line to the `~/.config/fishconfig.fish` file:
193+
194+
```bash
195+
source /usr/share/vcstool-completion/vcs.fish
196+
```
197+
198+
# How to contribute?
199+
200+
## How to report problems?
201+
202+
Before reporting a problem please make sure to use the latest version. Issues can be filled
203+
on [GitHub](https://github.com/MaxandreOgeret/vcstool2/issues) after making sure that this problem has not yet been
204+
reported.
205+
206+
Please make sure to include as much information, i.e. version numbers from vcstool2, operating system, Python and a
207+
reproducible example of the commands which expose the problem.
208+
209+
## How to try the latest changes?
210+
211+
Sourcing the `setup.sh` file prepends the `src` folder to the`PYTHONPATH` and the `scripts` folder to the `PATH`. Then
212+
vcstool2 can be used with the commands `vcs-COMMAND` (note the hyphen between `vcs` and`command` instead of a space).
213+
214+
Alternatively the `-e/--editable` flag of `pip` can be used:
215+
216+
```bash
217+
# from the top level of this repo
218+
pip3 install --user -e .
219+
```

0 commit comments

Comments
 (0)