Helpful Mercurial Tips

I spent a good bit of time trying to setup a Mercurial repository server on a Windows 7 Server that uses wamp.

I had to install TortoiseHg and Python 2.6.6 and the latest Mercurial in that order so that Mercurial would add it’s libraries to the Python install. All that is important because the library.zip file that comes with TortoiseHg doesn’t have the right Python modules you need to make the Mercurial hgweb.cgi work. Also I needed to install mod_wsgi on the wamp server which uses Apache.  Lastly, here is my hgweb.cgi

#!c:/Python26/python.exe
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories

import os; os.environ[“HGRCPATH”] = “C:wampwwwhg”

# Path to repo or hgweb config to serve (see ‘hg help hgweb’)
config = “c:\wamp\www\hg\hgweb.config”

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, hgwebdir, wsgicgi
application = hgwebdir(config)
wsgicgi.launch(application)