Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial Server on Apache/Windows

I'm searching for info to setup a Mercurial Server for Windows (7 or XP) with an Apache (xampp if it is useful to know it) with the Push Model, just like in this question but my team is composed of 5 to 8 (unsolvent) guys who are each one working in separated places, so I don't think the bitbucket solution or anyother non-private repo out there.

I think this post would do the trick, but i haven't experienced anything with cgi before,

Has anybody done this before? where can I find a more detailed explanation? thanks in advance

[EDIT]

I'm now getting this error: Premature end of script headers: hgwebdir.cgi

The log error says "no module named mercurial"

this is my hgwebdir.cgi file

#!c:/python24/python.exe
#
# An example CGI script to export multiple hgweb repos, edit as necessary

# adjust python path if not a system-wide install:
import sys
sys.path.insert(0, "c:/mercurial_library")

# enable importing on demand to reduce startup time
from mercurial import demandimport; demandimport.enable()

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

# If you'd like to serve pages with UTF-8 instead of your default
# locale charset, you can do so by uncommenting the following lines.
# Note that this will cause your .hgrc files to be interpreted in
# UTF-8 and all your repo files to be displayed using UTF-8.
#
#import os
#os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgwebdir_mod import hgwebdir
import mercurial.hgweb.wsgicgi as wsgicgi
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)
like image 235
Jhonny D. Cano -Leftware- Avatar asked Feb 09 '10 13:02

Jhonny D. Cano -Leftware-


1 Answers

I used the HgWebDir instructions:

Here is my httpd.conf piece for the mercurial sites (slightly edited):

<VirtualHost *:88>
    ServerName hg.example.com
    DocumentRoot c:/apache_sites/hg
    RewriteEngine on

    RewriteRule ^/$ /public [R]
    RewriteRule ^/public(.*) /public/hgwebdir.cgi$1 [L]
    RewriteRule ^/private(.*) /private/hgwebdir.cgi$1 [L]

    # mod_alias alternative (pretty url's)
    <Directory c:/apache_sites/hg >
        Order allow,deny
        Allow from all
        AllowOverride All
        Options ExecCGI
        AddHandler cgi-script .cgi
    </Directory>
    <Location /private/>
        AuthType Digest
        AuthName "hg.example.com"
        AuthDigestProvider file
        AuthUserFile c:/apache_sites/hg/hgusers
        AuthGroupFile c:/apache_sites/hg/hggroup
        AuthDigestDomain /private/
        Require group owner
    </Location>
    <Location /public/>
        AuthType Digest
        AuthName "hg.example.com"
        AuthDigestProvider file
        AuthUserFile c:/apache_sites/hg/hgusers
        AuthGroupFile c:/apache_sites/hg/hggroup
        AuthDigestDomain /public/
        <LimitExcept GET>
            Require group developer
        </LimitExcept>
    </Location>

    LogLevel debug
    ErrorLog "c:/apache/logs/hg-error.log"
    CustomLog "c:/apache/logs/hg-access.log" combined
    LogLevel debug
</VirtualHost>
# vim:se ft=apache:

I also had to turn on a few modules for Auth Digest, etc.

I put the hgwebdir.cgi in the root of the public and the private folders, and just put each of my hg repos in the repos subfolder under the appropriate folders.

Apache authentication took care of my authorization.

Then I just put a hgweb.config file in the same locations like this:

[collections]
repos = repos

[web]
allow_archive = bz2 gz zip
style = gitweb
baseurl = /public

Updated Question

The mercurial packages need to be on the PYTHON_PATH

This answer gives more detail.

like image 166
John Weldon Avatar answered Oct 13 '22 13:10

John Weldon