view hgweb.cgi @ 23993:eedade006458

revset: introduce _parsealiasdefn to parse alias definitions strictly This patch introduces "_parsealiasdefn" to parse alias definitions strictly. For example, it can avoid problems below, which current implementation can't. - the shorter name argument breaks referring the longer name one in the definition, if the former is completely prefix of the latter for example, the alias definition "foo($1, $10) = $1 or $10" is parsed as "_aliasarg('$1') or _aliasarg('$1')0" and causes parse error, because tail "0" of "_aliasarg('$1')0" is invalid. - argument names in the quoted string are broken for example, the definition "foo($1) = $1 or desc('$1')" is parsed as "_aliasarg('$1') or desc('_aliasarg(\'$1\')')" and causes unexpected description matching against not '$1' but '_aliasarg(\'$1\')'. To decrease complication of patch, current implementation for alias definitions is replaced by "_parsealiasdefn" in the subsequent patch. This patch just introduces it. This patch defines "_parsealiasdefn" not as a method of "revsetalias" class but as a one of "revset" module, because of ease of testing by doctest.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 02 Feb 2015 23:07:04 +0900
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)