Indefero

Indefero Git Source Tree

Root/doc/syncmercurial.mdtext

1# Plugin SyncMercurial by Benjamin Jorand
2
3The SyncMercurial plugin allows the direct creation and synchronisation of
4mercurial repositories with the InDefero database. The repositories will be
5published by hgwebdir.cgi using HTTP. It also handles private repositories.
6
7SyncMercurial is adapted from SyncSvn by Baptiste Michaud.
8
9## To Contact the Author
10
11 Benjamin Jorand <benjamin.jorand@gmail.com>
12
13## Apache configuration
14
15The simple way to share Mercurial repositories is to publish them
16using HTTP and `hgwebdir.cgi`.
17
18It first requires a config file called hgweb.config in the same
19directory where you put hgwebdir.cgi (for example,
20`/home/indefero/scripts`):
21
22 [collections]
23 /home/indefero/repositories/mercurial/ = /home/indefero/repositories/mercurial/
24
25Then configure a vhost this way :
26
27 ScriptAliasMatch ^/hg(.*) /home/indefero/scripts/hgwebdir.cgi$1
28 <Directory /home/indefero/scripts>
29 Options +ExecCGI
30 AuthName "Restricted"
31 AuthType Basic
32 AuthUserFile /home/indefero/auth/.htpasswd
33 <Limit PUT POST>
34 Require valid-user
35 </Limit>
36 </Directory>
37
38Enable the authentification for private repositories :
39
40 Include /home/indefero/scripts/private_indefero.conf
41
42## InDefero configuration
43
44First, you need to install the File_Passwd PEAR package:
45
46 $ sudo pear install File_Passwd
47
48Then, based on the paths provided in the Apache configuration, you
49need to put the following lines in your configuration file:
50
51 $cfg['idf_plugin_syncmercurial_passwd_file'] = '/home/indefero/auth/.htpasswd';
52 $cfg['idf_plugin_syncmercurial_path'] = '/home/indefero/repositories/mercurial';
53 $cfg['idf_plugin_syncmercurial_private_include'] = '/home/indefero/scripts/private_indefero.conf';
54 $cfg['idf_plugin_syncmercurial_private_notify'] = '/home/indefero/tmp/notify.tmp';
55 $cfg['idf_plugin_syncmercurial_private_url'] = '/hg/%s';
56
57You also need to provide the base definition of the hgrc file. For example:
58
59 $cfg['idf_plugin_syncmercurial_hgrc'] = array(
60 'web' => array('push_ssl' => 'false',
61 'allow_push' => '',
62 'description' => '',
63 'allow_archive' => 'bz2, zip, gz',
64 'style' => 'gitweb',
65 'contact' => ''),
66 'hooks' => array(),
67 'extensions' => array(),
68 );
69
70If you are note using Apache but Nginx, you may need to create the
71passwords as plain text passwords (see ticket 391). You can configure
72the password storage with the format you want. The default is `sha`
73you can set it to `plain` for nginx.
74
75 $cfg['idf_plugin_syncmercurial_passwd_mode'] = 'sha';
76
77See the [`FILE_PASSWD_*` constants](http://euk1.php.net/package/File_Passwd/docs/latest/File_Passwd/_File_Passwd-1.1.7---Passwd.php.html) for more choices.
78
79## Cron configuration
80
81As InDefero modifies the private_indefero.conf, apache needs to be reloaded.
82Each time this file is modified, a temporary file is created.
83
84 */5 * * * * /bin/sh /home/indefero/src/scripts/SyncMercurial.sh
85
86Edit this script and add correct values to `private_notify` and `reload_cmd`.
87
88## Hook configuratin
89
90To get notifications sent directly when pushing in your repositories,
91you need to add the following in your `.hgrc` file. The script will be
92called onec per push and will automatically send the notifications and
93sync the timeline.
94
95 [hooks]
96 changegroup = /home/indefero/src/scripts/hgchangegroup.php
97

Archive Download this file