Serving HG repositories on Windows 2012 R2 Server.

Jensen, Aaron ajensen at webmd.net
Wed Sep 23 16:46:58 UTC 2015


We have Mercurial running, without changes to Python or Mercurial code, on Windows 2008 R2. The steps are documented on the https://mercurial.selenic.com/wiki/HgWebInIisOnWindows wiki page.

I believe the problem is that you have hgweb.cgi in the URL, which won't work. See section 3, Configuring IIS Rewrite Rules.



From: Mercurial [mailto:mercurial-bounces at selenic.com] On Behalf Of Anders Ishoey (INT)
Sent: Wednesday, September 23, 2015 7:38 AM
To: mercurial at selenic.com
Subject: Serving HG repositories on Windows 2012 R2 Server.

Hi,

I'm trying to set up a 2012 R2 windows server with mercurial HG.
browsing, pull, clone,add,commit works. push doesn't work.

Setup:

Basic authentication, pass-through, SSL
Python 2.7 (had to modify random.py. line 114 to make it work)
I only have that single python version.

Using hgweb.cgi

mercurial-3.3.3.win32-py2.7.msi is installed in the python site-packages directory.

Browsing my repositories, cloning and updating on HTTPS works
However, I can't push.

Repositories are in c:\users\public\hg_repos
I have full rights in hg_repos and everything below.
Scripts are in c:\users\public\hgweb

I have placed a web.allow_push = * in .rc\hgrc in the repository

I have tried
mercurial-3.3.3.win-amd64-py2.7.msi
mercurial-3.5.1.win32-py2.7.msi
mercurial-3.5.1.win-amd64-py2.7.msi
mercurial-3.5.win-amd64-py2.7.msi
But none of these can even browse directories. (DLL load error. Dont know the name of the DLL)

In parallel with all this I have a regular (non-python) hg installation for "hg init" on the server.

Q1) Is there some setting in the IIS webserver itself that can prevent writing and cause the error?
Q2) Is there a known good installer configuration for Windows server 2012.
Q2a) is python 3.0 better? Is there a mercurial-python3.0 installer available?
Q3) Are there (simple) tools that can tell more aobut the error

Error:
password:
searching for changes
abort: HTTP Error 502: Bad Gateway

Or, with more detailed output:

abort: 'https://slasvn02/hgweb.cgi/TestRepo' does not appear to be an hg repository:
---%<--- (text/html)
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font><pre>Traceback (most recent call last):
  File "C:\Users\Public\hgweb\hgweb.cgi", line 57, in <module>
    application = hgweb(config)
  File "c:\Python27\lib\site-packages\mercurial\hgweb\__init__.py", line 26, in hgweb
    return hgwebdir_mod.hgwebdir(config, baseui=baseui)
  File "c:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 89, in __init__
    self.refresh()
  File "c:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 98, in refresh
    u = ui.ui()
  File "c:\Python27\lib\site-packages\mercurial\demandimport.py", line 114, in __getattribute__
    self._load()
  File "c:\Python27\lib\site-packages\mercurial\demandimport.py", line 86, in _load
    mod = _hgextimport(_import, head, globals, locals, None, level)

---%<---

hgweb\hgweb.config
# all repos in subdirectories of "collections" will be exposed/visible on the web interface.
[collections]
c:/Users/Public/hg_repos = c:/Users/Public/hg_repos

[web]
allow_push = *
users = *
push_ssl = true

hgweb\hgweb.cgi
#!c:\Python27\python.exe
#This location is the one that is called: c:\Users\Public\hgweb\hgweb.cgi

import os;
import sys;


sys.path.insert(0, "c:\program files (x86); c:\Python27\Lib\site-packages\mercurial")
sys.path.insert(0, "c:\Python27\Lib\site-packages\mercurial\pure")
os.environ['PYTHONPATH'] = "c:\Python27\Lib\site-packages\mercurial; "

import cgi
from cgi import escape

config="hgweb.config"

import cgitb; cgitb.enable(display=1)

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)

.rc\hgrc
[paths]
c:/Users/Public/hg_repos/TestRepo = c:/Users/Public/hg_repos/TestRepo

[ui]
username = "anders Ishoy "

[web]
baseurl = C:\Users\Public\hg_repos\TestRepo

allow_push = *
users = *

Thanks

Anders Ishøy-Rasmussen
Systems Architect
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20150923/4d712a85/attachment-0002.html>


More information about the Mercurial mailing list