Well, I can tell you... this is a painful adventure and for sure not worth saving 7$ a month. But sometimes you have to do what you have to do... Good luck.
Install Python
Install Python Windows Extensions (PYWIN32)
Intall and compile Mercurial source
- http://mercurial.selenic.com/release/mercurial-1.8.4.tar.gz
- c:\mercurial-source-1.8.4\
- python.exe setup.py --pure build_py -c -d . build_ext -i build_mo --force
- python.exe setup.py --pure install --force
- This will build and install Mercurial into the Python install folder eg. C:\Python27\Lib\site-packages\mercurial
- Add ;C:\Python27\scripts\ to the environment path
- Test by typing hg in command window
Setup Mercurial HgWeb Host on IIS 7
- http://code.google.com/p/isapi-wsgi/downloads/detail?name=isapi_wsgi-0.4.2.zip&can=2&q=
- python setup.py install
- http://selenic.com/repo/hg-stable/raw-file/1e6661e09818/contrib/win32/hgwebdir_wsgi.py
- Create the file folder that will be hosting your Mercurial IIS7 repository website. Eg. C:\Websites\hg\
- Copy hgwebdir_wsgi.py file to the website folder.
- Open hgwebdir_wsgi.py for editing by right clicking it and using the Python editor
- Set the hgweb config value to the website folder. hgweb_config = r'c:\Websites\hg\hgweb.config'
- Unless you are using a virtual application/directory set the path prefix to zero then save/close the file.path_prefix = 0
- Create a new hgweb.config file in the website folder with the following content:
[paths]
/ = c:\Repository\*
- Open a DOS prompt and set the directory to your website folder. Eg. c:\Websites\hg\
- Execute the following to compile a DLL called _hgwebdir_wsgi.dll: python hgwebdir_wsgi.py
- Create a new application pool in IIS Manager called “Mercurial-Repo”
- Set the .net framework version to “No Managed Code”
- Create a new website in IIS Manager pointing it to the website folder. Be sure to select the Mercurial-Repo application pool.
- Open up the Handler Mappings for your new web site.
- Add a new “Wildcard Script Map” with the Executable location pointing to the _hgwebdir_wsgi.dll in the website folder. Name it Mercurial-ISAPI
- Click the OK button, and click YES to allow the ISAPI extension.
- Assuming you have followed all directions carefully browsing to the newly created website should serve the empty repositories listing!
Using HG examples
- hg init c:\Repository\test
- hg clone http://sourcecontrol.yourserver.com/test
Pushing Changes
- By default, all repositores served via hgwebdir are read only – you cannot push changes to them. To change this, we can specify the users that should be able to push to the repositores by adding an "allow_push" section to our hgweb.config:
allow_push = Ken, Patrycja
SSL Certificate and Self-Signing With TortoiseHG and IIS
- Install SSL certificate and remove push_ssl = false
- hg push --insecure https://self-signed-host/repo
- C:\Program Files\TortoiseHg\hgrc.d
IIS Config for File-size, Time-Outs and blocked extensions
- In IIS Manager, click on the web site node, and click the Limits… link. Put time-out higher.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>[…]
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength ="2147482624" />
<fileExtensions>
<remove fileExtension=".cs" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
<system.web>
<httpRuntime executionTimeout="540000" maxRequestLength="2097151"/>
</system.web>
</configuration>
Error: [Errno 10054] An existing connection was forcibly closed by the remote host
This is a problem with the SSL module in Python 2.7.3/4 - it doesn't like IIS's SSL implementation. If you disable SSL v2 on your iis it will be solved. (IISCrypto)
Other ways of setting up Mercurial on Windows IIS
About Mercurial - TortoiseHG
Skip all this and get it from the cloud