I use Mercurial to version all of my scripts at work, and have a general preference for using IIS over Apache on Windows. Problem is that finding detailed instructions for installing Mercurial on Server 2008 R2 using IIS were hard to come by. I found some excellent instructions for 2003 on the Vampire Basic blog but they required some modification for use on 2008 R2. Below are the basic steps that I used for instaling Mercurial 1.5.1 on a 2008 R2 VM. One of the advantages of using IIS is that it’s easier to native authentication for Mercurial access control.
These instructions will give you a Mercurial install that uses IIS sharing out repositories located at E:\Repositories. Remote push is enabled, and is secured via the use of NTFS permissions on the individual repository folders. These instructions are about 7 months old and it looks like most of the software has been updated now, when I upgrade my server I will revise these instructions as necessary.
- Install Server 2008 R2
- Enable Remote Access
- Set hostname
- Join domain
- Add E:\ disk in Disk Manager
- Enable Web Server Role
- Add to default selections:
- HTTP Redirection
- CGI
- Logging Tools
- Tracing
- Basic Authentication
- Windows Authentication
- URL Authorization
- IP and Domain Restrictions
- IIS Management Scripts and Tools
- Install URL Rewrite 2.0 x64 (Download)
- Install TortoiseHg 2.0.0 x64 (Download)
- Install to E:\Program Files\TortoiseHg\
- Accept Installer Defaults
- Install Mercurial 1.8 (Download)
- Install to E:\Program Files\Mercurial\
- Accept Installer Defaults
- Install Python 2.6.6 (x86) (Download)
- Install for All Users
- Install to E:\Apps\Python26
- Accept Installer Defaults
- Configure Proxy in IE if required
- Clone Mercurial Source Files
- launch Admin CMD prompt and execute these commands
- If required, set http_proxy=proxy.example.com:8080
- Change to E:
- mkdir Repositories
- cd Repositories
- hg clone http://selenic.com/repo/hg
- mkdir e:\Apps\hgcgi
- copy hg\hgweb.cgi e:\apps\hgcgi
- xcopy “e:\Program Files\Mercurial\templates\*” e:\apps\hgcgi\templates /E /I
- write e:\apps\hgcgi\hgweb.cgi
- Change the config line to be and save/close the file
1) Config = "e:/apps/hgcgi/hgweb.config"
- Change the config line to be and save/close the file
- In Windows Explorer
- Extract E:\Program Files (x86)\Mercurial\Library.zip to E:\Apps\hgcgi
- launch Admin CMD prompt and execute these commands
- Configure hgweb.cgi
- Create new file called hgweb.config in e:\apps\hgcgi with below contents
[paths] / = E:\Repositories\** [web] style = monoblue baseurl = /hg push_ssl = false allow_push = * [extensions] hgext.notify = [hooks] changegroup = hg update >&2 changegroup.notify = python:hgext.notify.hook [email] from = mercurial@example.com [smtp] host = smtp.example.com [notify] sources = serve push pull bundle test = false config = template = Subject: {webroot|basename}: {desc|strip|firstline}\n\ndetails: {baseurl}{webroot|basename}/rev/{node|short}\nchangeset: {rev}:{node|short}\nuser: {author}\ndate: {date|date}\ndescription:\n{desc}\n [usersubs] developer@example.com = *
- Create new file called hgweb.config in e:\apps\hgcgi with below contents