We've had a couple of Subversion outages recently. As usual, development ground to a halt. People couldn't update their projects, couldn't get the history - we shelved some changes in Intellij for checkin later in the day... in short a pain we could live without. Such is life with centralised version control.

Since the advent of bitbucket I've been using Mercurial a lot for my own projects, so thought why not try it at work as a fallback for when subversion is down. Here's the quick recipe for Ubuntu based on this:

sudo apt-get install mercurial python-subversion
hg clone http://bitbucket.org/durin42/hgsubversion
cd hgsubversion
sudo python setup.py install

Edit ~/.hgrc and add

[extensions]
hgsubversion=

Now clone your repo with something like this:

hg clone svn+http://myhost.com/myrepo

You can push and pull your changes to subversion using regular "hg push" and "hg pull".

Works beautifully in Intellij too, but just make sure to:

  • Install Mercurial plugin
  • Recreate your project file if you have it checked into Subversion, Intellij will still think it's a subversion project despite the lack of .svn dir and presence of .hg. If you are using Maven you can just open your pom.xml to do this.
  • Remember that a Ctrl-K checkin is only checking into your local Mercurial. If you need to push changes to Subversion you'll have to issue a push command from the Mercurial menu.

I'm sure there's some gotcha's that might come up (seems like merging is one) - but on the face of it, it seems to work pretty well. 

I'll post windows instructions later when I get around to it - but this post seems to be pretty complete. Also don't confuse hgsubversion project with hgsvn (which has a deb package) - hgsvn looks to be deprecated in favour of hgsubversion.