changeset 28691:a04baf9c063b

revset: inline _getaliasarg() function This function is now much simpler than before. Inlining small functions helps to extract a reusable alias processor.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 14 Feb 2016 20:43:30 +0900
parents b56bf98c8afb
children 6b3b958daf03
files mercurial/revset.py
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Sun Feb 14 20:27:08 2016 +0900
+++ b/mercurial/revset.py	Sun Feb 14 20:43:30 2016 +0900
@@ -2261,12 +2261,6 @@
         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 @@
     """
     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):