hgweb.cgi
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 14 Oct 2012 15:10:13 -0400
changeset 17824 221c9c3146eb
parent 15475 85cba926cb59
child 26421 4b0fc75f9403
permissions -rwxr-xr-x
largefiles: always create the cache and standin directories when cloning The standin matcher only works if the .hglf directory exists (and it won't exist if 'clone -U' is used, unless --all-largefiles is also specified). Since not even 'update -r null' will get rid of the standin directory, this ensures that the standin directory always exists if the repo has the 'largefiles' requirement. This requirement is only set after a largefile is committed, so these directories will not be created for repos that have the extension enabled but have not committed a largefile. With the standin directory in place, 'lfconvert --to-normal' will now be able to download the required largefiles when converting a repo that was created with 'clone -U', and whose files are not in the usercache. The downloadlfiles command could probably be put inside the 'largefiles' requirement conditional too, but given that the user specified --all-largefiles, there is likely an expectation to print out the number of largefiles downloaded, even if it is 0.

#!/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
# (consult "installed modules" path from 'hg debuginstall'):
#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)