Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 28910:1203159c8928
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().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 29 Mar 2016 17:27:34 +0900 |
parents | 8d398155bfda |
children | 923fa9e06ea0 |
line wrap: on
line diff
--- a/mercurial/revset.py Tue Mar 29 17:21:11 2016 +0900 +++ b/mercurial/revset.py Tue Mar 29 17:27:34 2016 +0900 @@ -2254,7 +2254,11 @@ """Parsing and expansion rule set of revset aliases""" _section = _('revset alias') _parse = staticmethod(_parsealias) - _getlist = staticmethod(getlist) + + @staticmethod + def _trygetfunc(tree): + if tree[0] == 'func' and tree[1][0] == 'symbol': + return tree[1][1], getlist(tree[2]) def expandaliases(ui, tree, showwarning=None): aliases = _aliasrules.buildmap(ui.configitems('revsetalias'))