hgweb.cgi
author Adrian Buehlmann <adrian@cadifra.com>
Fri, 27 May 2011 15:59:52 +0200
changeset 14450 d1a1578c5f78
parent 11503 227b9f13db13
child 15475 85cba926cb59
permissions -rwxr-xr-x
commands.remove: don't use workingctx.remove(list, unlink=True) workingctx.remove(list, unlink=True) is unsuited here, because it does too much: it also unlinks added files. But the command 'hg remove' is specified to *never* unlink added files. Instead, we now unlink the files at the commands.remove level (if --after was not specified) and use workingctx.forget for all files. As an added bonus, this happens to eliminate a wlock acquire/release pair, since the previous implementation caused acquire wlock release wlock acquire wlock release wlock where the first pair of acquire/release was caused by the workingctx.forget call, and the second by the workingctx.remove call.

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/path/to/repo/or/config"

# Uncomment and adjust if Mercurial is not installed system-wide:
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)