| 1 | # Plugin SyncMercurial by Benjamin Jorand ␊ |
| 2 | ␊ |
| 3 | The SyncMercurial plugin allows the direct creation and synchronisation of␊ |
| 4 | mercurial repositories with the InDefero database. The repositories will be␊ |
| 5 | published by hgwebdir.cgi using HTTP. It also handles private repositories.␊ |
| 6 | ␊ |
| 7 | SyncMercurial 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 | ␊ |
| 15 | The simple way to share Mercurial repositories is to publish them␊ |
| 16 | using HTTP and `hgwebdir.cgi`.␊ |
| 17 | ␊ |
| 18 | It first requires a config file called hgweb.config in the same␊ |
| 19 | directory where you put hgwebdir.cgi (for example,␊ |
| 20 | `/home/indefero/scripts`):␊ |
| 21 | ␊ |
| 22 | [collections]␊ |
| 23 | /home/indefero/repositories/mercurial/ = /home/indefero/repositories/mercurial/␊ |
| 24 | ␊ |
| 25 | Then 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 | ␊ |
| 38 | Enable the authentification for private repositories :␊ |
| 39 | ␊ |
| 40 | Include /home/indefero/scripts/private_indefero.conf␊ |
| 41 | ␊ |
| 42 | ## InDefero configuration␊ |
| 43 | ␊ |
| 44 | First, you need to install the File_Passwd PEAR package:␊ |
| 45 | ␊ |
| 46 | $ sudo pear install File_Passwd␊ |
| 47 | ␊ |
| 48 | Then, based on the paths provided in the Apache configuration, you␊ |
| 49 | need 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 | ␊ |
| 57 | You 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 | ␊ |
| 70 | ␊ |
| 71 | ## Cron configuration␊ |
| 72 | ␊ |
| 73 | As InDefero modifies the private_indefero.conf, apache needs to be reloaded.␊ |
| 74 | Each time this file is modified, a temporary file is created. ␊ |
| 75 | ␊ |
| 76 | */5 * * * * /bin/sh /home/indefero/src/scripts/SyncMercurial.sh␊ |
| 77 | ␊ |
| 78 | Edit this script and add correct values to `private_notify` and `reload_cmd`.␊ |
| 79 | |