[Lemon-devel] Private mercurial repository

Ladanyi, Akos ladanyi at tmit.bme.hu
Tue Dec 18 15:43:30 CET 2007


Hi,

There are multiple ways to make a mercurial repository accessible to
others. The one I will describe here makes it possible to access your
repository over HTTP. It uses a Python script which communicates with
the webserver using CGI. The process is described in detail at [1], I
will just write down how I got this working.

1. First you need a copy of hgwebdir.cgi. You can get this from the
tarball of the latest stable mercurial release or form the public_html
subdirectory of the home directory of Alpar or me on lime
(/home/{alpar,akos}/public_html/hgwebdir.cgi). Note that the
hgwebdir.cgi linked from the documentation at [1] is too new (it does
not work).

2. Copy hgwebdir.cgi to your public_html directory.

3. Make it executable (chmod 755 ~/public_html/hgwebdir.cgi).

4. If you are doing this on lime (recommended) the permissions of your
home directory and public_html directory should be appropriate.
Otherwise refer to [1].

5. Create a private mercurial repository for yourself by cloning the
main lemon repository:

mkdir ~/hg
cd ~/hg
hg clone http://lemon.cs.elte.hu/hg/lemon/ lemon

6. Create a file named hgweb.config in your public_html folder with the
following contents:

[collections]
/home/my-username/hg = /home/my-username/hg

The hgwebdir.cgi script makes the mercurial repositories available found
in the folder at the right hand side of the equal sign, while it strips
off the text on the left hand side from the path names on the web
interface.

7. That's it. Try opening the following URL in a web browser (after
substituting your username):
http://lime.cs.elte.hu/~my-username/hgwebdir.cgi

It should look like this:
http://lime.cs.elte.hu/~alpar/hgwebdir.cgi
Or this:
http://lime.cs.elte.hu/~akos/hgwebdir.cgi

You can pull changes from other users like this:
hg pull http://lime.cs.elte.hu/~somebody/hgwebdir.cgi/lemon/

And you can push your changes to your repository on lime like this:
hg push ssh://me@lime.cs.elte.hu/hg/lemon/

If you don't know what this pulling and pushing means, please read the
2nd chapter of [2].

regards,
Akos

[1] http://hgbook.red-bean.com/hgbookch6.html#x10-1310006.6
[2] http://hgbook.red-bean.com/hgbook.html






More information about the Lemon-devel mailing list