Painless multiple repository management
Can you imagine a world without version control systems? I’m old enough that I can actually remember. Let me tell you kids, it wasn’t pretty.
I’ve learned my lessons, and today I use version control for almost everything: code, server config, personal documents, kids pictures, you name it. Even my home directory is under version control! As I’m writing this I have over 50 repositories checked out. They are of all kinds: git, mercurial, darcs, subversion, …
fatal: Not a git repository (or any of the parent directories): .git
The thing is, I can never remember which project is using which tool. Python uses mercurial, gunicorn uses git, selenium uses subversion… Also keeping all my repository up to date is a pain! :’(
Enter mr, a Multiple Repository management tool developed by Joey Hess:
The mr(1) command can checkout, update, or perform other actions on a set of repositories as if they were one combined respository. It supports any combination of subversion, git, cvs, mercurial, bzr, darcs, cvs, vcsh, fossil and veracity repositories, and support for other revision control systems can easily be added. (There are extensions adding support for unison and git-svn.)
It is extremely configurable via simple shell scripting. Some examples of things it can do include:
- Update a repository no more frequently than once every twelve hours.
- Run an arbitrary command before committing to a repository.
- When updating a git repository, pull from two different upstreams and merge the two together.
- Run several repository updates in parallel, greatly speeding up the update process.
- Remember actions that failed due to a laptop being offline, so they can be retried when it comes back online.
This thing saved my life! Now, the first thing I do when I come in the morning, or when I switch from my desktop to my laptop, is run this one simple command:
mr -j4 up
and all my repositories are updated in no time!
Switching to a brand new computer? To install mr you just need to copy a single file into your PATH, then make your mrconfig available somewhere online and run:
mr bootstrap http://www.somewhere.com/me/mrconfig
Et voila! All your dear repositories have been checked out, you can start hacking right away!
And when you want to commit something, no matter the project, always use the same command:
it will be translated for you into the appropriate git, mercurial or subversion dialect.
Need to leave in a hurry and not sure you have committed everything you were working on?
will tell you of any pending change.