Setting Up A Mercurial Webserver

The version control system I use at work and home is Mercurial and I have been trying to learn more about it recently. What I want to do at the moment is have all of my repos stored in a central location so I can make sure they are backed up. I’d also like to be able to get the repos from any computer at work.

As it turns out Mercurial has a built-in webserver and this can handle multiple repositories. So created a directory on my computer where I put all my projects and then I’ve setup a script that will start-up the Mercurial webserver.

To set all this up I first created a directory, “/var/hg”, and in this directory is a sub directory called “repos” and a configuration file called “hgweb.config”. An example of the contents of this file are below.

repos/ = repos/
description=some description here
allow_archive = bz2 gz zip

After doing this I then put all of my repositories in the repos directory, each repository can have it’s own local web configuration. This is a quick shell snippet that will launch a Mercurial webserver.

hg serve –webdir-conf /var/hg/hgweb.config

Thats it! Well… mostly anyway. I have missed of some detail as I can’t remember exactly what I did. Perhaps I should start recording the things I do step by step here so I cant forget.