Search code examples
apachemercurialwindows-xphgweb

Running Mercurial with Apache on Windows XP


I've been struggling to get Mercurial working with Apache on Windows XP.

I've read and tried the suggestions at the following SO threads: 1, 2, 3 & 4

So far all I can is a blank page and when I view the source I can see:

<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>

What I'm working with:

  • Apache 2.2 -- C:\Program Files\Apache Software Foundation\Apache2.2\
  • Python 2.4 (as recommended by Mercurial site) -- C:\Program Files\Python\2.4\
  • Mercurial 1.6 -- C:\Program Files\Mercurial\
  • mod_python 3.3.1
  • Apache DocumentRoot: C:\htdocs\hg\ accessed via http://hg.paperclip.dev (added to hosts file)
  • Hg Repository (on a networked drive): H:\repo\

I have a feel that part of the complication is that I have my repo on a networked drive. Which I can access either through a networked drive letter H or via \\SERVER\WebDev\repo\

My mercurial.ini in the Mercurial installation directory is as follows:

[ui]
editor = Notepad
username = paperclip <p@paperclip.com>

My hgweb.config in the Hg DocumentRoot served by apache (C:\htdocs\hg\)

[collections]
//SERVER/WebDev/repo = //SERVER/WebDev/repo**

My hgweb.cgi in the Hg DocumentRoot serverd by apache (C:\htdocs\hg\)

#!C:/Program Files/Python/2.4/python.exe

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

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

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

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb
from flup.server.fcgi import WSGIServer
application = hgweb(config)
WSGIServer(application).run()

My VirtualHosts files for Apache

<VirtualHost *:80>
  ServerName hg.paperclip.dev
  #ServerAlias paperclip.com *.paperclip.com
  ServerAdmin p@paperclip.com
  CustomLog "logs/hg-access.log" combined
  ErrorLog "logs/hg-error.log"

  RewriteEngine on
  RewriteRule (.*) C:/htdocs/hg/hgweb.cgi/$1

  # Or we can use mod_alias for starting CGI script and making URLs "nice":
  # ScriptAliasMatch ^(.*) C:/htdocs/hg/hgweb.cgi/$1

  <Directory "C:/htdocs/hg/">

    Order allow,deny
        Allow from all
        AllowOverride All
        Options ExecCGI FollowSymLinks +Indexes
        AddHandler cgi-script .cgi

  </Directory>
</VirtualHost>

Taking into account the above configuration, I would welcome some suggestions to get this working. Anything I could try as I've hit a total dead end.

Many thanks in advance.

-P.


Solution

  • This was posted just yesterday:
    Setup Mercurial Server in Windows Machine - Tutorials are outdated

    This guy managed to get HG + Apache to work on Windows 7.
    I know, you're using XP and not Win 7, but maybe this link helps you anyway.