Installing Mercurial 2.1 on IIS 7
If you ever need to set up Mercurial on Windows Server 2008 R2 then you should read Jeremy Skinner’s Setting up Mercurial on IIS7. It’s a great article that guides you every step of the way, from installing Mercurial and Python, to configuring IIS and setting up SSL.
Because I was using later versions of Mercurial and Python than those used in the guide (I was using Mercurial 2.1 and Python 2.6; there’s a note in the guide stating it used Mercurial 1.4.3 with Python 2.5.4, and should work with Mercurial 1.5 and Python 2.6.4), there were a couple of problems I had to workaround - if you’re using similar versions of Mercurial and Python to me then hopefully this’ll help you out, although YMMV:
-
Since Mercurial 1.6+,
hgwebdir.cgi
has been merged withhgweb.cgi
. Therefore wherever the article mentionedhgwebdir.cgi
, I swapped it forhgweb.cgi
. -
After extracting
library.zip
toC:\inetpub\wwwroot\hg
, and copying thetemplates
folder toC:\inetpub\wwwroot\hg
, I tried to accesshttp://name_of_server/hg/hgweb.cgi
but Python threw anImportError
and complained it couldn’t find the mercurial module. To get round this I:- Reverted the previous copy and extract steps i.e. removed the
templates
folder, and the extractedlibrary.zip
, fromC:\inetpub\wwwroot\hg
- Downloaded
mercurial-2.1.1.win-amd64-py2.6.exe
from https://bitbucket.org/tortoisehg/thg-winbuild/downloads/ and ran the installer (NB you should download the .exe most appropriate for your server). This found the version of Python installed on my system and copied the relevant libraries / modules to Python’s site-packages folder. I was then able to browse tohttp://name_of_server/hg/hgweb.cgi
without any problems.
- Reverted the previous copy and extract steps i.e. removed the