Frage

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.

War es hilfreich?

Lösung

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.

Andere Tipps

I don't know why you want to restrict access to the UI part since any information provided here is accessible if they can access the files, but so be it :P

If you want some clean solution, I think taking the code of hgweb.cgi and rewrite it won't be too difficult, but I think you can also do something quicker : hg serve -t /dev/null

This will use /dev/null as the template for the UI part, so the users will receive an "Internal Server Error" page when connecting to the server but will be able to access the repository just fine through hg.

Only downside, the log will be field with errors if there's access through a browser.

PS: if you're not on a Unix system, just use any empty directory as a source for the templates.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top