# HG changeset patch # User Yuya Nishihara # Date 2016-02-14 11:43:30 # Node ID a04baf9c063b4bad4a8704e42ad94d04f0ef3ff1 # Parent b56bf98c8afb21f2f43cfca9b4173cfed98dfd83 revset: inline _getaliasarg() function This function is now much simpler than before. Inlining small functions helps to extract a reusable alias processor. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2261,12 +2261,6 @@ def optimize(x, small): return w + wa, (op, x[1], ta) return 1, x -def _getaliasarg(tree): - """If tree matches ('_aliasarg', X) return X, None otherwise""" - if tree[0] == '_aliasarg': - return tree[1] - return None - # the set of valid characters for the initial letter of symbols in # alias declarations and definitions _aliassyminitletters = set(c for c in [chr(i) for i in xrange(256)] @@ -2460,9 +2454,9 @@ def _expandargs(tree, args): """ if not tree or not isinstance(tree, tuple): return tree - arg = _getaliasarg(tree) - if arg is not None: - return args[arg] + if tree[0] == '_aliasarg': + sym = tree[1] + return args[sym] return tuple(_expandargs(t, args) for t in tree) def _expandaliases(aliases, tree, expanding, cache):