Mercurial: The Definitive Guide

This entry is part 5 of 3 in the series Version Control

Mercurial, The Definitive Guide

I Love Version Control Software, as I like programming languages. So even if “Mercurial, The definitive guide” was published months ago, I asked O’Reilly to review it. The Bryan O’Sullivan book is very compact, and will explain the mercurial world in less than 250 pages.

After years of CVS and Subversion, I feel something was missed: even with subversion, doing merge was hard and time-consuming. Branching and delivery was a pain.Why so?…

The first book chapter does a brief history of the  revision control software, from SCCS (1970) to CVS (end of ’80) and Subversion (2001). Mercurial spring into life in the 2005, the same year Git come to life.

Mercurial is a python based distributed version control. In respect of Git, Mercurial is a lot easier to use, and it is very efficient also under MS-Windows. Because is based only on python (and some native extension if you want better performance), it is very compact.

Chapter 2 & 3 give you a tour of mercurial, from installation to a day by day use.

Chapter 3 is fully devoted to Merging and branching: a task which a distributed version control system make very easy to do. Even Joel Spolsky has just written a blog post about Mercurial, explaining the reason it rocks: distributed version control thinks in term of atomic change set, which give you a better isolation and integration when it comes to merging.

The book shines when it explain the internal organization of Mercurial (Chapter 4, Behind the Scene) and when deals with very advanced stuff like Mercurial Queues (Chapter 12&13, Managing Changes with Mercurial Queues).

Mercurial Queues are important if you plan to integrate third-part software you need to patch. Suppose you need to customize a complex software like a complex html parser or renderer (like Apache Cocoon). It is a bad practice, but sometimes you need it.

Mercurial Queues give you the ability to record your personal patch. But you also need to update Cocoon to the last version, for bug-fixing and performance improvements.

Mercurial Queue is able to de-apply your patch, give you the option of updating Cocoon, and then re-apply your personal customizations.

The entire procedure is quite complex, but the tool give you a clean methodology to deal with the challenge. I think this is the true value of the book, because it is not easy to find such tutorial on the internet, and the author deals a lot with this topic.

The Web interface is described on chapter 6, along with hooks-based customization (chapter 10, Handling Repository Events with Hooks).

Mercurial can be extended via plugins, and its core is conceptually smaller than Git because a lot of extra feature are managed by plugins.

On the opposite, Git has a lot of complex feature on its core.

Finally, chapter 14 deals with extension installation, and we found  a funny misprint on page 222. Under “Cherry-Picking with the transplant Extension”, we read “Need to have a long chat with Brendan about this”.

Conclusion: a nice, compact and proficient book on distributed version control. A must-have if you plan to organize your projects with Mercurial

Other resources

Mercurial Visual Tutorial