Setup Mercurial Server in Windows Machine - Tutorials are outdated

Angel Ezquerra angel.ezquerra at gmail.com
Tue Aug 16 11:22:23 UTC 2011


On Tue, Aug 16, 2011 at 5:40 AM, Yan Cheng CHEOK <yccheok at yahoo.com> wrote:
> I am refering to http://mercurial.selenic.com/wiki/HgWebDirStepByStep, and trying to setup it in Windows machine (Windows 7).
>
> 1. I can no longer download hgwebdir.cgi from http://www.selenic.com/repo/hg-stable/raw-file/tip/hgwebdir.cgi. The link is dead.
>
> 2. I was told to modify hgwebdir.cgi content to sys.path.insert(0, "c:/dev/Mercurial/lib"), but I didn't found any folder in my latest Mercurial installation. I can only see there is a zip file on it.
>
> Seems the information on the tutorial is pretty outdated. Any good guides for me to setup Mercurial server in Windows machine?
>
> Thanks and Regards
> Yan Cheng CHEOK
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>

Yan,

are you using Apache or IIS?

I found configuring mercurial on windows to use IIS to be quite hard.
Eventually I decied to give Apache a try and I found it was much
easier to setup. I faced a couple of issues but they were easy to
overcome with the help of people on this list.

My server is a Windows 2003 x64 machine. It is only accessible on our
intranet (i.e. no external internet access) is named mercurial. All
our repos are placed on a folder called "c:\mercurial".

If remember correctly all I had to do was:

1) Install the Apache (2.2), the Apache mod_wsgi module, Python (2.6)
and the mercurial source 1.9 source package.
- Note that the official mercurial source MSI installer did not work
for me (see http://mercurial.selenic.com/bts/issue2582). Instead I had
to use a version made by "Alexander Grebenschikov", which you can find
in "https://bitbucket.org/archer256/hgserve/".
- To install the "mod_wsgi.so" module I simply downloaded it from
"http://code.google.com/p/modwsgi/", renamed it to "mod_wsgi.so" and
copied itinto "%Program Files%\Apache Software
Foundation\Apache2.2\modules".

2) I created a folder named "C:\hg_server". In it I placed two files,
"hgweb.config" and "hgweb.wsgi", with the following contents:
- "hgweb.config:
----------------
[web]
push_ssl = false
allow_push = *
style = monoblue
allow_archive = zip
logourl=http://mercurial
motd =<br><hr><br>If you have any problems with this server please
contact <a href="myuser at myserver.com">Angel Ezquerra</a><br><br>

[paths]
/ = c:/mercurial/**
----------------

- "hgweb.wsgi":
----------------
# An example WSGI for use with mod_wsgi, edit as necessary
# See http://mercurial.selenic.com/wiki/modwsgi for more information

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "c:/hg_server/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide:
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

# enable demandloading to reduce startup time
from mercurial import demandimport; demandimport.enable()

from mercurial.hgweb import hgweb
application = hgweb(config)
----------------

Unfortunately you must set "config" to the full absolute path to the
"hgweb.config" file (i.e. you cannot just set it to "hgweb.config").

3) I edited the Apache http.conf file in "%Program Files%\Apache
Software Foundation\Apache2.2\conf" as follows:

- On the section where all the LoadModule calls are done, I added the
following line:

LoadModule wsgi_module modules/mod_wsgi.so

- On the section where the default "<Directory>" entry is defined, I
added the following:

WSGIScriptAlias / "C:/hg_server/hgweb.wsgi"

<Directory "C:/hg_server">
	AllowOverride None
	Options None
	Order allow,deny
	Allow from all
	
	AddHandler wsgi-script .wsgi
</Directory>

And that is about it I believe.

I hope this helps.

Cheers,

Angel



More information about the Mercurial mailing list