Posts tagged: MERCURIAL

Transit of Mercurial

I’m quite fond of Mercurial, despite (though perhaps partly because of) using Git daily for the last ten years.

The first DVCS I used was Darcs, which I liked; then I tried Mercurial and liked it even more. That was 2007; I didn’t get my first job in a “Git shop” until 2010.

I’ve always found the Mercurial UX to be more pleasant than Git. Little things like invoking commands with unique left-substring, or seeing inbound or outbound commits with a single memorable command. Less operational complexity and fewer ways to shoot yourself in the foot, but with equivalent power.

The syncbox

I move between a couple different computers regularly: my old 12" PowerBook and the 15" MacBook Pro my job provides me with. Like all multi-computer users I periodically bump up against the challenges of what files (and versions) are where, especially when there’s work in progress.

To further complicate things, I also have an extra laptop running Ubuntu. And sometimes I just SSH to my web server from somebody else’s machine.

Branching and merging in real life

At work I still mostly use Subversion for version control. Its main selling points: stable, performs as expected, integrates nicely with Trac, holds all our old stuff (legacy inertia).

Note that “pain-free branching and merging” is not on that list. (And don’t give me the old “branching is cheap in svn!” line. It’s not about the branching, it’s about the merging.) A couple years ago I started also using Mercurial and plan to eventually replace svn with it entirely. The aspect of Mercurial that made my life better recently is its support for branching and merging.

History lesson

This has been going around – give people a peek at what commands you run most often. I ran this on my server, where I spend most of my shell time:

> history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s\n",a[i],i}}'|sort -rn|head
  103   hg
   81   cd
   67   ll
   29   ./manage.py
   23   ab
   21   re-ap
   17   hgup
   14   svn
   13   cat
   12   ls

Notes:

  • Mercurial has pushed my use of Subversion way down.
  • I can’t remember what I was benchmarking with ab, but I’m sure it’s faster now!
  • re-ap is my alias for restarting Apache (re-po restarts Postfix, re-my restarts MySQL, etc.).
  • hgup is a simple shell script that updates the live instance of my site by fetching from the Mercurial repository in the staging instance. It would make a neat Django custom management command, but not one tied to a particular app.

Mercurial 1.0 released

Very cool news – Mercurial 1.0 has been released. See the announcement and the site for details. There are no earth-shaking individual changes in this release, just a long list of improvements that have been made since 0.9.5.

One of the new features is easy_install friendliness, so assuming you’ve got that installed, getting the new version of Mercurial is as easy as:

$ sudo easy_install http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz

If you want to be kind to the server, since it’s getting pounded today, you can do this instead in order to make your request via the Coral CDN: