1

I'm looking for a way to display static HTML content using an Apache 2 webserver while also having a Mercurial repository under the same URL. E.g. under http://www.myserver.org/projectname there should be the project HTML available if browsed with a normal web-browser, but it should be possible to clone the projects Mercurial repository using hg clone http://www.myserver.org/projectname. It is basically what http://bitbucket.org has. I think this might be possible to achieve by configuring Apache to use the hgweb.cgi script only for Mercurial requests and not for normal HTML GET request. However, I don't now which requests Mercurial uses (hopefully not GET) and how to configure Apache accordantly.

A little bit more background:
In need this for multiple repositories / projects (currently ~2400). So far I tried hgweb as explained in Publishing Repositories which works good for the web view of the repository but doesn't allow me to show any other information beside author, name and description (from .hg/hgrc [web] section). The variable substitution in hgweb is very limited and so it doesn't allow to provide arbitrary variables. I know I could simply have the static HTML pages and hgweb under different URLs, but this is not meet the constrains given to me.

Martin Scharrer
  • 181
  • 1
  • 7

1 Answers1

1

To understand what kind of request send mercurial - we have perfect tcpdump.

I start tcpdump, do hg clone http://selenic.com/hg

and see that hg do GET request /hg?cmd=capabilities , /hg?cmd=getbundle , /hg?cmd=batch

I think , you can collect all needed requests for hg, and configure apache (or nginx, or some other proxy) forward such requests to hgweb.cgi

Korjavin Ivan
  • 2,250
  • 2
  • 26
  • 41
  • I was actually looking for a more direct solution which is already tested. But you seem to hit something: After looking at the HG Python code and searching a little more using the new found keywords it turns out that all commands really use `cmd` as part of the HTTP query string. I hacked something together based on RewriteRule and ScriptAlias to only have these requests forwarded to the CGI script but have the others handled by Apache directly. I'm still hoping someone posts a more "official" way to do it. Thanks! – Martin Scharrer Oct 10 '11 at 07:13