MercurialVersionControlServer
Back to current versionRestore this version

MercurialVersionControl

Benötigt wird ein Web Server, Mercurial, Python

Apache2 + mod_python + mod_cgi + mod_auth

VirtualHost anlegen (post,put sperren)

 <VirtualHost *>
  ServerAdmin webmaster@back2heaven.de
  ServerName hg.back2heaven.de
  DocumentRoot /mnt/mercurial
  # index.cgi ist das webdir.cgi aus /usr/share/doc/mercurial/examples/
  ScriptAliasMatch        ^/hg(.*)        /mnt/mercurial/cgi-bin/index.cgi$1
  ScriptAliasMatch        ^/cgi-bin(.*)  /mnt/mercurial/cgi-bin/index.cgi$1
  ScriptAlias /cgi/ /mnt/mercurial/cgi-bin/
  <Directory /mnt/mercurial/cgi-bin/>
   DirectoryIndex index.cgi
   AllowOverride None
   Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
   AddHandler cgi-script .cgi
   AuthUserFile /etc/apache2/htpasswd
   AuthName "hgdev"
   AuthType Basic
   <Limit POST PUT>
    Require valid-user
   </Limit>
  </Directory>
  ErrorLog /var/log/apache2/error_hg.log
  LogLevel warn
  CustomLog /var/log/apache2/access_hg.log combined
  ServerSignature on
 </VirtualHost>
#hgweb.config
 [collections]
 /mnt/mercurial/ = /mnt/mercurial/
 #eine leerzeile muss bei mir drin sein
#!/usr/bin/env python
#hgwebdir

import cgitb, sys
cgitb.enable()

from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication
import mercurial.hgweb.wsgicgi as wsgicgi

def make_web_app():
    return hgwebdir("hgweb.config")

wsgicgi.launch(wsgiapplication(make_web_app))

nun kann man unter /mnt/mercurial alle repositorys hochladen!

todo

htpasswd -c /etc/apache2/htpassed anlegen
hg init /mnt/mercurial mein test_hg
  1. /etc/mercurial/hgrc hochladen von daten via http [web] allow_archive = bz2 gz zip allowpull = true contact =developer@schwarze-allianz.de maxchanges = 15 maxfiles = 15 style = gitweb # wenn man kein ssl nutzen will push_ssl = false # brauch man allow_push = *

todo

dann kann man das lokale repository hochladen
lade das rep. runter hg clone http://hg.back2heaven.de/hg/test

dannach kann man es bearbeiten und mit hg push wieder zum server schicken