vics provides a command line tool to invoke vcs commands on multiple repositories.
Project description
What is vics?
Vics is a version control system (VCS) tool, designed to make working with multiple repositories easier.
This project is a fork of vcstool by Dirk Thomas.
Note: This tool should not be confused with vcstools (with a trailing
s) which provides a Python API for interacting with different version control systems. The biggest differences between the two are:
vicsdoesn't use any state beside the repository working copies available in the filesystem.- The file format of
vics exportuses the relative paths of the repositories as keys in YAML which avoids collisions by design.vicshas significantly fewer lines of code thanvcstoolsincluding the command line tools built on top.
How does it work?
Vics operates on any folder from where it recursively searches for supported repositories. On these repositories vics invokes the native VCS client with the requested command (i.e. diff).
Which VCS types are supported?
Vics supports Git, Mercurial, Subversion, and Bazaar.
How to use vics?
The script vics can be used similarly to the VCS clients git, hg etc.
The help command provides a list of available commands with an additional description:
vics help
By default vics searches for repositories under the current folder. Optionally one path (or multiple paths) can be passed to search for repositories at different locations:
vics status /path/to/several/repos /path/to/other/repos /path/to/single/repo
Exporting and importing sets of repositories
Vics can export and import all the information required to reproduce the versions of a set of repositories.
Vics uses a simple YAML format to encode this information.
This format includes a root key repositories under which each local repository is described by a dictionary keyed by its relative path.
Each of these dictionaries contains keys type, url, and version.
If the version key is omitted the default branch is being used.
This results in something similar to the following for a set of two repositories (vics cloned via Git and rosinstall checked out via Subversion):
repositories:
vics:
type: git
url: git@github.com:dirk-thomas/vics.git
version: master
old_tools/rosinstall:
type: svn
url: https://github.com/vcstools/rosinstall/trunk
version: 748
Export set of repositories
The vics export command outputs the path, vcs type, URL and version information for all repositories in YAML format.
The output is usually piped to a file:
vics export > my.repos
If the repository is currently on the tip of a branch the branch is followed. This implies that a later import might fetch a newer revision if the branch has evolved in the meantime. Furthermore if the local branch has evolved from the remote repository an import might not result in the exact same state.
To make sure to store the exact revision in the exported data use the command line argument --exact.
Since a specific revision is not tied to neither a branch nor a remote (for Git and Mercurial) the tool will check if the current hash exists in any of the remotes.
If it exists in multiple the remotes origin and upstream are considered before any other in alphabetical order.
Import set of repositories
The vics import command clones all repositories which are passed in via stdin in YAML format.
Usually the data of a previously exported file is piped in:
vics import < my.repos
The import command also supports input in the rosinstall file format.
Beside passing a file path the command also supports passing a URL.
Only for this command vics supports the pseudo clients tar and zip which fetch a tarball / zipfile from a URL and unpack its content.
For those two types the version key is optional.
If specified only entries from the archive which are in the subfolder specified by the version value are being extracted.
Validate repositories file
The vics validate command takes a YAML file which is passed in via stdin and validates its contents and format.
The data of a previously-exported file or hand-generated file are piped in:
vics validate < my.repos
The validate command also supports input in the rosinstall file format.
Advanced features
Show log since last tag
The vics log command supports the argument --limit-untagged which will output the log for all commits since the last tag.
Parallelization and stdin
By default vics parallelizes the work across multiple repositories based on the number of CPU cores.
In the case that the invoked commands require input from stdin that parallelization is a problem.
In order to be able to provide input to each command separately these commands must run sequentially.
When needing to e.g. interactively provide credentials all commands should be executed sequentially by passing:
--workers 1
In the case repositories are using SSH git@ URLs but the host is not known yet vics import automatically falls back to a single worker.
Run arbitrary commands
The vics custom command enables to pass arbitrary user-specified arguments to the vcs invocation.
The set of repositories to operate on can optionally be restricted by the type:
vics custom --git --args log --oneline -n 10
If the command should work on multiple repositories make sure to pass only generic arguments which work for all of these repository types.
How to install vics?
On Debian-based platforms the recommended method is to install the package python3-vics. On Ubuntu this is done using apt-get:
If you are using ROS you can get the package directly from the ROS repository:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install python3-vics
If you are not using ROS or if you want the latest release as soon as possible you can get the package from packagecloud.io:
curl -s https://packagecloud.io/install/repositories/dirk-thomas/vics/script.deb.sh | sudo bash
sudo apt-get update
sudo apt-get install python3-vics
On other systems, use the PyPI package:
sudo pip install vics
For development, uv is used to manage dependencies:
uv sync --group dev
uv run vics help
uv run pytest -s -v test
Setup auto-completion
For the shells bash, tcsh and zsh vics can provide auto-completion of the various VCS commands. In order to enable that feature the shell specific completion file must be sourced.
For bash append the following line to the ~/.bashrc file:
source /usr/share/vics-completion/vics.bash
For tcsh append the following line to the ~/.cshrc file:
source /usr/share/vics-completion/vics.tcsh
For zsh append the following line to the ~/.zshrc file:
source /usr/share/vics-completion/vics.zsh
For fish append the following line to the ~/.config/fishconfig.fish file:
source /usr/share/vics-completion/vics.fish
How to contribute?
How to report problems?
Before reporting a problem please make sure to use the latest version. Issues can be filled on GitHub after making sure that this problem has not yet been reported.
Please make sure to include as much information, i.e. version numbers from vics, operating system, Python and a reproducible example of the commands which expose the problem.
How to try the latest changes?
Sourcing the setup.sh file prepends the src folder to the PYTHONPATH and the scripts folder to the PATH.
Then vics can be used with the commands vics-COMMAND (note the hyphen between vics and command instead of a space).
Alternatively, install the package in editable mode with uv or pip:
# from the top level of this repo
uv sync --group dev
# or: pip3 install --user -e .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vics-0.4.0.tar.gz.
File metadata
- Download URL: vics-0.4.0.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b0db5061d4d2709599cef3524167767162ee785f73a44415e1630ef0512cb8c
|
|
| MD5 |
bc5465338c5c213544e1798bc6b02785
|
|
| BLAKE2b-256 |
23621aa4a8c966da8712d1e6391b006bf7b3549110299c72e9c29be8b4530b10
|
File details
Details for the file vics-0.4.0-py3-none-any.whl.
File metadata
- Download URL: vics-0.4.0-py3-none-any.whl
- Upload date:
- Size: 46.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2083f0c7d517f0ab02c60ea931371262fc6252088df2a88d813a2d925ed85ab5
|
|
| MD5 |
f0c76d139da7e20abfbfb965af42420c
|
|
| BLAKE2b-256 |
6c1f8881c48a0fbfacaacee750f8274b7770e65e93a39c23bdca6e27697f49f7
|