view hgweb.cgi @ 18063:34a1a639d835

revset.children: ignore rev numbers that are too low This replaces unnecessary parentrevs() calls with calculating min(parentset). Even though the min operation is O(size of parentset), since parentrevs is relatively expensive, this tradeoff almost always works in our favour. In a repository with over 400,000 changesets, hg perfrevset "children(X)" takes: Set X Before After -1 0.51s 0.06s -1000: 0.55s 0.08s -10000: 0.56s 0.10s -100000: 0.60s 0.25s -100000:-99000 0.55s 0.19s 0:100000 0.60s 0.61s all() 0.72s 0.74s The relative performance is similar for Mercurial's own repository -- several times faster in most cases, slightly slower for revisions close to 0 and all().
author Siddharth Agarwal <sid0@fb.com>
date Fri, 07 Dec 2012 10:37:43 -0800
parents 85cba926cb59
children 4b0fc75f9403
line wrap: on
line source

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