parser: factor out _trygetfunc() that extracts function name and arguments
This provides a customization point for templater. In templater, there are
two ways to call a unary function: func(x) and x|func. They are processed
differently in templater due to historical reasons, but they should be
handled in the same way while expanding aliases. In short, x|func should be
processed as syntactic sugar for func(x).
_funcnode and _getlist() are replaced by _trygetfunc().
parser: make _getalias() return (alias, pattern-args) pair
This allows us to factor out a function that extracts a function (name, args)
pair. See the next patch for why.
parser: drop redundant comparison between alias declaration tree and pattern
Since _getalias() explicitly tests the type and name of the pattern tree, we
don't need to compare "a.tree == tree" for 'symbol', and "a.tree == tree[:2]"
for 'func', where tree is either ('symbol', name) or ('func', ('symbol', name)).
This change helps implementing better handling of template aliases. See the
subsequent patches for details.
The alias.tree field is removed as it is no longer used.
patchbomb: fix public-is-missing hint
Without this, there is no space between a hash and the -r preceding the next
line in the use hg push hint
run-tests: set HGMODULEPOLICY for --pure
Without this, my python 2.6 virtualenv test run with --pure and
--local fails with:
+ ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.8, but Mercurial is currently using Python with sys.hexversion=
33950192: Python 2.6.9 (unknown, Apr 13 2016, 12:40:12)
+ [GCC 4.9.2
20141101 (Red Hat 4.9.2-1)]
+ at: ~/hg/py26/bin/python