sudo aptitude install mercurial
sudo aptitude install apache2 libapache2-mod-wsgi
Создаем пользователя hg и его папку
sudo useradd hg
sudo mkdir /home/hg
sudo chown hg:hg /home/hg
sudo -u hg mkdir /home/hg/rep /home/hg/www
Создаем виртуальный хост
файл: /etc/apache2/sites-available/mercurial
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName hg.myhost.ru
DocumentRoot /home/hg/www/
# настройки wsgi
WSGIProcessGroup hg
WSGIDaemonProcess hg user=hg group=hg threads=2 maximum-requests=1000
# путь до скрипта, обрабатывающий wsgi
WSGIScriptAlias / /home/hg/rep/hgwebdir.wsgi
# ограничение доступа к репозиторию
<Location />
AuthType Basic
AuthName "Mercurial repositories"
AuthUserFile /home/hg/.hg.htpasswd
Require valid-user
</Location>
</VirtualHost>
Подключаем виртуальный хост
sudo a2ensite mercurial
Создаем hg (wsgi) приложение
Файл: /home/hg/rep/hgwebdir.wsgi
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
os.environ['HGENCODING'] = 'utf-8'
from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication
path = os.path.dirname(os.path.abspath(__file__))
application = hgwebdir(path+'/hgwebdir.conf')
Создаем репозиторий “myproject”
sudo -u hg hg init /home/hg/rep/myproject
Создаем файл настроек /home/hg/rep/hgwebdir.con
[web]
style = coal
[paths]
myproject = /home/hg/rep/myproject
в раздел path нужно прописывать все созданные репозитории
Добавление пользователей
Создание файла паролей и добавление пользователей
htpasswd -c /home/hg/.hg.htpasswd user1
htpasswd /home/hg/.hg.htpasswd user2
Перезагружаем Apache
sudo /etc/init.d/apache restart
push через web
Для того что-бы можно было пушить через apache, нужно в файле репозитория .hg/hgrc прописать:
[web]
allow_push = user1, user2
#allow_push = *
push_ssl = false
в параметре allow_push перечислить пользователей либо поставить “*” —
все пользователи. параметр push_ssl = false дает возможность пушить
через http (по умолчанию можно только через https)
Готово.Источник