Those of you who are familiar with distributed version control systems likely understand that the notion of a central repository has been removed from the required architecture. However, there remain several benefits to having one or more shared repositories. LShift were kind enough to bestow upon the world Mercurial-Server, an open source Mercurial authentication, authorization and repository management system. This is the tool you’ve been looking for to setup a single server which hosts shared repositories. To really get an appreciation of what this can do, check out the online docs.
A prerequisite to successful installation of Mercurial-Server is Mercurial itself. Yum.
yum install mercurial
While I know my way around a nix box, I’m far from what some would call adept. So, when I go to start experimenting with some new product, I usually pray for a smooth installation. This is rarely the case, and my experience with this product brought no such fortune.
The provided README and online documentation indicates that mercurial-server is targeted toward Debian based systems and most easily installed via some package management system. Had I been installing this on one of my Ubuntu boxes, I’m sure I would not be writing this article, but I was stuck with FC 14. So, reading on, they kindly suggest that on Red Hat and other variants running ‘sudo make setup-useradd’ would possibly work. After giving it a whirl, it very nearly did. After examining the output, it seems that the manual generation was failing due to an XSL parsing problem. “No biggy. It looks like its just a reflection of their online docs anyway.” Taking a look at the MakeFile it was trivial to identify the phase which was causing the failure. Simply running the sub commands directly, while omitting the doc generation did the trick. Without further adieu:
wget http://dev.lshift.net/paul/mercurial-server/mercurial-server_1.1.tar.gz tar -xzvf mercurial-server_1.1.tar.gz cd mercurial-server_1.1 sudo make installetc sudo make pythoninstall sudo make useradd sudo make inituser
Another thing to note is that the documentation makes reference to tooling installed at, “/usr/share/mercurial-server/”, examination of the MakeFile shows that these goodies are actually installed at, “/usr/local/share/mercurial-server/.” Once you’re done setting it up, you might want to read up on how to config it. Check out their docs at http://dev.lshift.net/paul/mercurial-server/docbook.html.
Update: One thing the docs will not mention is that your newly created hg user will likely need to have a password set on the account before you will be able to connect. While you will be using PKI authentication, accounts without passwords set are recognized as disabled by the system. Though the mercurial-server software does prevent direct logins with the hg user, it is important to choose a significantly complex password to protect from possible vulnerabilities.