hgweb.cgi
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 29 Dec 2012 00:40:18 +0100
changeset 18211 518c1403838f
parent 15475 85cba926cb59
child 26421 4b0fc75f9403
permissions -rwxr-xr-x
clfilter: fallback to unfiltered version when linkrev point to filtered history On `filectx`, linkrev may point to any revision in the repository. When the repository is filtered this may lead to `filectx` trying to build `changectx` for filtered revision. In such case we fallback to creating `changectx` on the unfiltered version of the reposition. This fallback should not be an issue because `changectx` from `filectx` are not used in complex operation that care about filtering. It is complicated to work around the issue in a clearer way as code raising such `filectx` rarely have access to the repository directly. Linkrevs create a lot of issue with filtering. It is stored in revlog entry at creation time and never changed. Nothing prevent the changeset revision pointed to become filtered. Several bogus behavior emerge from such situation. Those bugs are complex to solve and not part of the current effort to install filtering. This changeset is simple hack that prevent plain crash in favor on minor misbehavior without visible effect. This "hack" is longly documented in to code itself to help people that would look at it in the future.

#!/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)