Skip to content

Hg in Control

April 8, 2010

If you have a set of files that you need to synchronize across multiple computers and you’d also like to be able to edit these files on the different computers then you have a problem. This problem is called the Version Control Problem. The problem isn’t just a matter of keeping the files on each machine in sync it’s also a matter of figuring out which copy of the file on each machine represents the latest copy as well as merging the different versions into a final “uptodate” file. Tools like SyncToy and Unison will only get you so far; they can provide two-way synchronization but that’s pretty much it.

A better solution is to use a real bonafide revision control system. Specifically the best RCS out there: Mercurial. Mercurial is a distributed revision control system — this is just a way of saying it super-rocks compared to a centralized RCS like Subversion — that provides a robust, easy-to-use solution to the version control problem.

If you have an Ubuntu box lying around take five minutes to install Mercurial on it. Next you’ll want to create a repository using the and “publish” it — that is make it available it to remote clients over the web. The easiest way to do this is to throw:


[web]
push_ssl=False
allow_push=*

into /etc/mercurial/hgrc. Beware this means anybody and everybody and Skeletor has write-access to your repo. Only do this if you’re working on a protected network. Or look into the secure alternative repository publishing strategies. Starting the server is as easy as:


$ hg serve --name "my-repo" -d -p 8001 --pid-file ../my-repo.pid

Stopping the server is just a matter of killing the process.

Once you’ve got your repository on the web the “hard” part is over. Grab a Mercurial client like TortoiseHg and clone the repo on wherever you like.

Of course if you’re not familiar with version control systems you’ll likely want to learn how to actually use Mercurial. You’re in luck because there’s plenty of great documentation out there. Check out:

Advertisements

From → netbook, tips, ubuntu

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: