Search code examples
mercurialhgweb

hgweb without Web Interface


This may seem like a dumb idea, but is there anyway to serve a mercurial repository over http without any of the webinterface features bundled in hgweb.cgi .

I would like users to be able to clone/push the repository over http:// but I do not want them to be able to view the repositories or files through a web interface.

Static HTTP is an option, but the official mercurial docs claim that this is very slow.

If this is not trivial, is anyone aware of a example code that serves an hg repository over http, without any support for a browser interface preferrably?

Thanks in advance.


Solution

  • I did a quick check of the hgweb files and found this:

    Find the hgweb/webcommands.py file of your mercurial installation, and open it in an editor. Change the following code at the top of the file:

    __all__ = [
       'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev',
       'manifest', 'tags', 'bookmarks', 'branches', 'summary', 'filediff', 'diff',
       'annotate', 'filelog', 'archive', 'static', 'graph', 'help',
    ]
    

    to this:

    __all__ = [
    ]
    

    This disables all web commands; you can still view the list of repos, but not any more infos about them.

    I did check hg clone and hg pull, but not hg push.