Search code examples
pythoniis-7mercurialhgweb

How do I get hgweb to actually display the repository I want?


I am having an infuriating experience with IIS7, Python 2.6, Mercurial 1.7.2, and hgweb.cgi.

After battling for an afternoon getting hgweb.cgi to work, I finally got it to render in the browser using hgweb.cgi and IIS7. I can now see a blank rendering of the web server, that is, a header with no repositories listed.

Now, according to the multipe sites I've read after scouring through Google results, I know that I have to update my hgweb.config file to point to some repositories.

However, for the life of me, I can't get it to list my repository using either the [paths] or [collections] entries.

I have the following directory structure, (simplified but illustrative...):

c:\code c:\code\htmlwriter c:\code\CommandLineProjects\Clean

The latter two directories have mercurial repositories in them.

I am trying to publish the repository in c:\code\htmlwriter

Now, if I make this entry in hgweb.config

[paths]
htmlwriter = c:\code\htmlwriter

I get nothing listed in my output.

If I put

[paths]
htmlwriter = c:\code\*

I get something, but not what I want, i.e. this:

htmlwriter/CommandLineProjects/Clean

(Note that the about drills down one directory level farther than I want it to).

I can't seem to find any combination of paths, asterisks, or anything else that will serve up the repository in c:\code\htmlwriter. It appears to always want to go one level deeper than I want it to, or to show nothing.

I know that my hgweb.config file is being read because I can change the style tag in it and it changes what is rendered.

I have read and re-read multiple time a number of resources on the web, but they all say what I'm trying should be working. For instance, I followed this instructions to the letter with no good results:

http://www.jeremyskinner.co.uk/mercurial-on-iis7/

Anyone have any suggestions?


Solution

  • I'll answer my own question:

    The solution is that the path listed in the [paths] section is relative to the directory where the hgweb.config file is residing.

    So, if you have your repository in:

    c:\code\myrepo
    

    and your hgweb.config file is in:

    C:\inetpub\hgcgi
    

    then the entry in your hgweb.config file needs to be:

    /myrepo = ../../code/myrepo
    

    That was the trick -- to put the correct relative path.

    I was never able to get hgweb.cgi to work with a repo on a different drive.