You have a lot of version control repositories. Sometimes you want to update them all at once. Or push out all your local changes. You use special command lines in some repositories to implement specific workflows. Myrepos provides a mr command, which is a tool to manage all your version control repositories.
myrepos
is a command-line tool which adds the mr
command to your environment.
mr
does not care about different version control systems, it supports all of them.
The standard way to use mr
is to go into each one of your repositories and run the command mr register
for mr to add it to your configuration file in ~/.mrconfig
.
For advanced example of myrepos
usage, have a look at Adam Spiers' mr config on Github.
If a command, for example mr update
, is run in e.g. ~/projects/wine/mainline-src
, then mr
only runs it on that repository.
If it is run in the parent, e.g. ~/projects/wine/
, then it only runs the update command in all children of that directory.
In this case, it would run update in all the Wine project repositories.
If the command is run on a higher level, e.g. in ~/projects
then the command applies to all registered repositories in projects/.
.
Through this hierarchical structure, it is possible to manage all of your repositories using a single configuration file, both personal and work related, simply by running your commands in the relevant directory.
The primary commands you will want to use are:
mr checkout
clones any repositories which don’t already existmr update
updates all the repositoriesmr clean
prints the ignored/untracked files in repos, use -f to remove files as wellmr status
shows you the status of each repo; handy to figure out if any repos have pending changesmr diff
shows you the diffs from all reposmr run
allows you to run an arbitrary command in all repos
Check out the manual of myrepos, it is not long and has some nice tidbits about parallel execution.
Alright, I will give up that last one: use the switch mr -j 5
to run 5 concurrent jobs.
This is where the tool starts to shine, not only is this a full-featured repository manager; it also gives you tools to do batch operations across multiple repositories.
Custom commands under the [DEFAULT]
section only apply to the repositories which are under that section.
This is why all the custom commands are placed at the very top of the .mrconfig
file.
Links