<?xml version="1.0" encoding="UTF-8"?>
<essay xml:lang="en" version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:gal="http://norman.walsh.name/rdf/gallery#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<info>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
<title>Mercurial</title><biblioid class="uri">http://norman.walsh.name/2007/07/19/mercurial</biblioid>
<volumenum>10</volumenum>
<issuenum>69</issuenum>
<pubdate>2007-07-19T09:01:22-04:00</pubdate>
<date>$Date$</date>
<author>
      <personname>
<firstname>Norman</firstname>
	<surname>Walsh</surname>
</personname>
    </author>
<copyright>
      <year>2007</year>
      <holder>Norman Walsh</holder>
    </copyright>
<abstract>
<para>The version control system, not my personality.</para>
</abstract>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Mercurial"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#SelfReference"/>
</info>

<para xml:id="p1">The moment I learned that such a thing as a
“<wikipedia page="Version_control">version control system</wikipedia>” existed,
I was hooked. Over the years, I've used a few. I started with
<wikipedia page="Revision_Control_System">RCS</wikipedia> then moved to
<wikipedia page="Concurrent_Versions_System">CVS</wikipedia>. I used
<wikipedia page="IBM_Rational_ClearCase">ClearCase</wikipedia> for a while.
(At the time, I was working remotely over dialup. Let's just say that ClearCase was
not optimized for that scenario and leave it at that.) I've done a
<wikipedia>Perforce</wikipedia> checkout or two, for something
<wikipedia>TeX</wikipedia>-related as I recall, though I can't really claim
to have used it.</para>

<para xml:id="p2">A few years ago, I switched to
<wikipedia page="Subversion_%28software%29">Subversion</wikipedia>.
Atomic commits. The ability to rename files and directories. Atomic commits.
Versioned metadata. Atomic commits. I've been very happy with it. Especially
the ability to make atomic commits.</para>

<para xml:id="p3">A version control system is absolutely imperative if you're
working collaboratively. There's really no other practical way to
manage multiple developers updating the same code base.</para>

<para xml:id="p4">But I use a version control system for
<emphasis>everything</emphasis> that I do. I recommend that you do the
same. I manage papers and projects that only I touch with Subversion.
Heck, I have my whole home directory checked in.</para>

<para xml:id="p5">Using version control for my own stuff has two obvious benefits.
First, it protects me from the single most likely to fail component of
my work environment: me. If some line of editing turns out to be a complete
dead-end, you can just throw it away and check out the “last good” version.
Second, it provides automatic backups. Well, sorta.</para>

<para xml:id="p6">You see, I work disconnected from the net fairly often (think
airplanes, vacations, etc.) and I really don't like to be unable to
check stuff in. It just increases the window of opportunity for me to
screw up and if that window gets big enough, I will.</para>

<para xml:id="p7">In order to make it possible to work without an internet
connection, I keep a lot of stuff checked into repositories on my
local disk. So, yeah, if I <command>rm *</command> (instead of
<command>rm *~</command>) in some directory, I can recover. But if the
disk fails or the laptop is stolen, I'm hosed. Oh, I have proper
backups, but they could be a few weeks or a month old. You want to
lose a month's work? Neither do I.</para>

<para xml:id="p8">This is where distributed revision control systems come in. Instead of
a central repository that you have to be connected to, they work peer-to-peer.
One practical consequence of this is that you can do check-ins, commits, or any
other action while you're disconnected. The next time you are connected, you can
“push” these changes to your peers.</para>

<para xml:id="p9">I've been interested in trying one of these systems for a while
(there are several). Since it looks like
<link xlink:href="http://openjdk.dev.java.net/">OpenJDK</link> will use
<wikipedia page="Mercurial_%28software%29">Mercurial</wikipedia>, I figured
that would be a good place to start.</para>

<para xml:id="p10">It was fairly straightforward to setup Mercurial on my web host
and create some repositories. With some trepidation and a few days
hacking, I've converted the source for
<link xlink:href="http://nwalsh.com/"/>,
<link xlink:href="http://docbook.org/"/>, and even
<link xlink:href="http://norman.walsh.name/"/> to Mercurial.</para>

<para xml:id="p11">So far, it's been pretty painless. There are
Subversion-to-Mercurial conversion tools, so I didn't loose any of my
history. I have a few scripts that extract information from the commit
logs; those had to be changed to work with Mercurial. I rely on
keyword substitution (the $Date$ keyword provides the last-updated
date), so I had to get and install the right
<link xlink:href="http://www.selenic.com/mercurial/wiki/index.cgi/KeywordExpansionExtension?highlight=%28keyword%29">Mercurial extension</link> for
that. It turns out that Ubuntu has not-quite-the-most-recent Mercurial
release, so it took a couple of email exchanges with the author of the
extension to get it working.</para>

<para xml:id="p12">Then I just had to wait for my laptop to rebuild
<emphasis>everything</emphasis>. Seems to have succeeded overnight. If
you see something that looks screwed up, please do tell me.</para>

<para xml:id="p13">(Before you hit the “add comment” link, yes I know, I could have
accomplished the same goal, probably much more easily, with <link xlink:href="http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt">svnsync</link>.
But I wouldn't have learned anything practical about distributed
version control that way, would I?)</para>

</essay>

