# mkdir /var/hg
# cd /var/hg
# mkdir repos
# cd repos
# sudo -u www-data hg init project_name
hgwebdir.cgi
#!/usr/bin/env python
#
from mercurial import demandimport; demandimport.enable()
import cgitb
cgitb.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
import mercurial.hgweb.wsgicgi as wsgicgi
application = hgwebdir('/var/hg/hgweb.config')
wsgicgi.launch(application)
hgweb.config
[collections]
repos/ = repos/
[web]
style = gitweb
baseurl = /hg
=========== set apache2 ========
# cd /etc/apache2/sites-enabled
hg.conf
ScriptAliasMatch ^/hg(.*) /var/hg/hgwebdir.cgi$1
<Directory /var/hg>
AllowOverride None
Options ExecCGI FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Location /hg>
DAV on
AuthType Basic
AuthName "hg"
AuthUserFile /etc/apache2/dav.passwd
Require valid-user
</Location>
# htpasswd -c /etc/appache2/dav.passwd user
# /etc/init.d/apache2 restart
# sudo chown -Rh www-data:www-data /var/hg
# sudo chmond +x /var/hg/hgwebdir.cgi
.hg/hgrc
回复删除---
[ui]
username = guan
[web]
contact = guan
description = guan san
allow_push = *
push_ssl = false
[hooks]
changegroup.notify = python:hgext.notify.hook
[notify]
maxdiff = 300