Friday, September 25, 2009

Version Control Systems

As developers, we all love and hate the various version control systems out there. RCS, CVS, Subversion, Perforce, CMVC, Visual Source Safe, Clear Case Mercurial, Git, Darcs, Bazaar, the list goes on and on.

Each of them has their own set of strengths and weaknesses. I won't go over all of them here, as that topic can easily become a book, and whatever weaknesses I point out will have someone else point out that I obviously just don't know how to use the tool properly. I will discuss one of them, though, and that's Mercurial.

About 6 months ago, I started my first ever TurboGears project. Digging in, learning what I could, participating in the IRC channel, I kept seeing mention of Mercurial, and how wonderful it was. I finally decided to take the plunge, and try it out.

My version control has not been the same since. If I can at all avoid it, I do not use anything but Mercurial. I even use hg-git and hgsubversion to allow me to access Git and Subversion repositories from within Mercurial. The end result is a tool that works for me, and makes my life easier.

Basic usage, to get a set of files into version control, couldn't be simpler:

cd $directory; hg init ; hg commit -A -m "Message"
That's it. The files are now under version control. When you make a change, simply do "hg commit". When you add a file, "hg add", and remove is "hg remove". I've just taught you about 99% of daily usage commands.

Mercurial supports extensions, too.  You can get an extension that let you maintain a patch queue, similar to quilt. Another extension presents a graphical view of the branching history of your source. Still other functionality will let you self-host (on your laptop) a repository and allow others to pull from it.

With Mercurial, I get a tool that's easily managed, has a full plugin architecture that allows me to bridge version control systems transparently, and is something even I can extend (and I have).

 I've barely scratched the surface of what Mercurial can do. I'd suggest taking a look both at the online documentation on their website, and also at the Mercurial book.

Before I close out this post, I want to mention Git, since I know some of you will feel the need to point out how wonderful Git is. I don't dispute that Git has some great features. It also has some amazing complexity (last time I looked, over 140 executables got installed). I have no interest in managing that much complexity. Mercurial suits me very well. I doubt I'll be changing any time soon.

No comments: