Mercurial Server on Apache / Windows

I am looking for information to install Mercurial Server for Windows (7 or XP) using Apache (xampp if it's useful to know) using the Push model, as in this question , but my team consists of 5-8 (dissenting) guys who work in separate places, so I donโ€™t think this is a solution for a bitpack or any other non-private repo.

I think this post could do the trick, but I have not experienced anything with cgi before,

Has anyone done this before? where can i find a more detailed explanation? thank you in advance

[EDIT]

Now I get this error: Invalid end of script headers: hgwebdir.cgi

A log error says "there is 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)
+5
3

HgWebDir:

httpd.conf ( ):

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

Auth Digest ..

hgwebdir.cgi hg- repos .

Apache .

hgweb.config , :

[collections]
repos = repos

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

PYTHON_PATH

.

+9

, , .

hgwebdir - wsgi , , wsgi, mod_wsgi apache2. mod_wsgi , cgi, python , .

, wsgi middleware URL - ..

, , trac ( wsgi), trac hgwebdir, , , , repoze.who.

, python paste - , , hgwebdir .

"""
Wsgi wrapper of hgweb that is paste compatible
"""
import os
from mercurial import demandimport
demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir

CONFIG_FILE_KEY = "hgwebdir.config"

def hgweb_paste(global_config, **local_conf):
    """
    looking for a config file setting in global or local
    """
    cfg = global_config
    cfg.update(local_conf)
    config_file = cfg.get(CONFIG_FILE_KEY)
    if config_file and os.path.exists(config_file):
        return hgwebdir(config_file)
    else:
        raise KeyError, "%s not set or %s does not exist" % (CONFIG_FILE_KEY,config_file)

, ...

[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 6543

[app:main]
use = egg:hg.paste#hgweb
hgwebdir.config = %(here)s/hg.config
+8

All Articles