Below I did what I did after doing a lot of research to get the hgwebdir.cgi installation on IIS6. It is based on the following sites:
You will need to install the following on the server:
- Mercurial (I used version 1.5)
- Python 2.6 The version of Python depends on the version of Mercurial installed. Mercurial 1.5 uses Python 2.6. Install x86 even if you are using x64.
For me there were the following steps:
- Create a directory for the website. I used c: \ inetpub \ wwwroot \ hg.
- In IIS, right-click the folder for hg, select properties, select the Home Directory tab.
- Click the "Create Application" button. Set execution permissions for scripts.
- On the Home Directory tab, click the Configuration button. In the "Application Settings" drop-down list, click the "Add" button to add the application extension. The executable is c: \ Python26 \ python.exe -u "% s" "% s". Extension -.cgi. Set the "verbs" to "restriction: GET, HEAD, POST". Check both Script engines and make sure the file exists.
- On the Directory Security tab, click the Edit button in the Authentication and Access Control sections. Uncheck all authentication methods and check the "Basic authenification" method. Set the default domain if you like the Active Directory domain.
- In IIS, click on the Web Services Extensions folder in the left pane. Click the Add New Web Service Extension link. The extension name must be Python, the required file is: c: \ Python26 \ python.exe -u "% s" "% s". Make sure the new extension is "Allowed."
Now is the time to check if Python is working. Create a file in a new Hg folder called test.cgi. Paste the following python code:
print 'Status: 200 OK' print 'Content-type: text/html' print print '<html><head>' print '' print '<h1>It works!</h1>' print '' print ''
Open a browser on your website, for example http: //localhost/hg/test.cgi
You should see "It works!" in the browser.
Next, enable hgwebdir.
- Delete test.cgi
- clone the hg repo into a new directory:
https://www.mercurial-scm.org/repo/hg/
- copy hgwebdir.cgi to your web directory: c: \ inetpub \ wwwroot \ hg \ from the cloned hg repo
- Edit the file and change
application = hgwebdir('hgweb.config') wsgicgi.launch(application)
to
application = hgwebdir('c:\inetpub\wwwroot\hg\hgweb.config') wsgicgi.launch(application)
- Unzip the Library.zip file in the Mercurial directory, c: \ Program Files \ Mercurial \, in your web directory, c: \ inetpub \ wwwroot \ hg \
- Copy the templates directory from c: \ Program Files \ Mercurial \ templates \ to c: \ inetpub \ wwwroot \ hg \ templates \
- Create the hgweb.config file in your web directory.
Now is the time to check it out. Go to the following URL in the browser, http: //localhost/hg/hgwebdir.cgi
- Modify hgweb.config and paste the following:
[collections] \\server\share$\Hg\ = \\server\share$\Hg\ [web] allow_push = * push_ssl = false
These are all my preferences, for example, we have our repositories in subdirectories on \\ server \ share $ \ Hg. The web application will run under the permissions of the registered user through a browser, so they will need read and write permission for the shared resource.
The final step is to allow long connections that can happen when you first clone a repo. Run the following command to increase the timeout to 50 minutes:
cd \inetpub\AdminScripts\ cscript adsutil.vbs GET /W3SVC/CGITimeout cscript adsutil.vbs SET /W3SVC/CGITimeout 3000
Clay Lenhart Apr 6 '10 at 9:40 2010-04-06 09:40
source share