Mercurial, and other monsters

February 6th, 2008

Brad Lassey recently vented some understandable frustration with Mercurial, the new distributed version control system we’re using for Mozilla 2 development.

I sympathize with Brad, especially because almost all of the comments seem to be along the lines of “No no, you’re mistaken, Mercurial makes things easier, not harder” or “Well, you should have done X,” without understanding Brad’s problem.

Still, I think Brad’s frustration is somewhat misplaced. The other side of the story involves Windows Vista. Brad did some work in a Mercurial repo on Vista, then zipped up the whole repo and moved it to a Windows XP VM. This is supposed to work just fine. But (and this part, we think, this is due to a brilliant top-secret feature of Windows Vista called virtualization, a feature so awful the mobile developers have resorted to logging in as Administrator all the time) Brad ended up with a zip file that had multiple copies of some files. Whatever Vista put into that zip, extracting it on XP produced a corrupt repository. (Specifically, Mercurial’s working directory was at revision X, but it thought it was at revision Y.)

Mercurial is different in a lot of ways. Compared to CVS, it’s more flexible and more complex. Mercurial vs. CVS reminds me of C++ vs. C:

  • There are a lot of quite different ways to use it.
  • There are some ease-of-use issues.
  • It’s easy to think you understand it, and how to use it, and which features to ignore, and exactly how everyone else should use it, when you really really don’t.
  • Conversations about how to use it are not going to be trivial.
  • Getting started by using Mercurial as “a better CVS” doesn’t deliver a huge win and is a little frustrating, because some things don’t quite translate.
  • Perhaps most importantly, shooting yourself in the foot feels a lot like C++. I’ve done it a few times now—boring stories.

After ten years of ups and downs with C++, I’ve made my peace with it and wouldn’t want to go back to pure C.

Update: It turns out Brad’s problem was at least partly caused by the Mercurial binary distribution he was using. The default hgmerge script was broken in an exciting way. I believe it’s fixed in the latest binary distribution.