How do I set up Mercurial and hgweb on IIS?

前端 未结 10 1726
梦谈多话
梦谈多话 2020-11-28 18:01

I\'ve been looking all over for decent instructions on how to get hgweb working on IIS but I haven\'t found much of worth.

There\'s this \"step by step\" on the Merc

相关标签:
10条回答
  • 2020-11-28 18:41

    Use mercurial to clone the mercurial repository:

    hg clone https://www.mercurial-scm.org/repo/hg/
    

    you will find hgwebdir.cgi at the top level. It should install like any other cgi script.

    0 讨论(0)
  • You can try HgLab. This isn't exactly hgwebdir; rather it is a purely managed Mercurial implementation with push and pull server and repository browser.

    0 讨论(0)
  • 2020-11-28 18:45

    Below are what I did after doing a fair amount of research for geting hgwebdir.cgi setup on IIS6 . It is based on the following sites:

    • http://python.markrowsoft.com/iiswse.asp
    • http://www.jeremyskinner.co.uk/mercurial-on-iis7/

    You'll 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 running x64.

    The steps for me were:

    • Create a directory for the website. I used c:\inetpub\wwwroot\hg.
    • In IIS, right click on the folder for hg, select properties, select the Home Directory tab.
    • Click on the Create application button. Set the execute permissions to "scripts".
    • Still in the Home Directory tab, click on the Configuration button. In the "Application Configuration" popup, click the Add button to add an application extension. The Executable is c:\Python26\python.exe -u "%s" "%s". The extension is .cgi. Set the "verbs" to "limit to: GET,HEAD,POST". Check both Script engine and Verify that file exists.
    • In the Directory Security tab, click on the Edit button in the Authentication and access control section. Uncheck all authentication methods, and check the "Basic authenication" method. Set the Default domain if you like to your Active Directory domain.
    • In IIS, click on the Web Service Extensions folder on the left panel. Click on "Add a new Web service extension" link. Extension name should be Python, the required file is c:\Python26\python.exe -u "%s" "%s". Make sure the new extension is "Allowed".

    Now is a good time to test that Python is working. Create a file in your 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 the browser to your site, for instance, http://localhost/hg/test.cgi

    You should see "It works!" in the browser.

    Next let's get the hgwebdir working.

    • Delete test.cgi
    • clone the hg repo to 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\, to your web directory, c:\inetpub\wwwroot\hg\
    • Copy the templates directory from c:\Program Files\Mercurial\templates\ to c:\inetpub\wwwroot\hg\templates\
    • Create a file called hgweb.config in your web directory.

    Now is a good time to test it out. Go to the following URL in the browser, http://localhost/hg/hgwebdir.cgi

    • Edit 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 instance we have our repos in subdirectories at \\server\share$\Hg. The web app will run under the permissions of the logged in user via the browser, so they'll need read/write permissions to the share.

    The last step is to allow for long connections which 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
    
    0 讨论(0)
  • 2020-11-28 18:49

    The hg red book contains some much better general instructions than I've seen in other places. They are not IIS specific, but they are quite good:

    http://hgbook.red-bean.com/read/collaborating-with-other-people.html#sec:collab:cgi

    0 讨论(0)
提交回复
热议问题