[PATCH 3 of 7] revset: unindent codes in _getalias() function

Yuya Nishihara yuya at tcha.org
Wed Apr 13 11:55:15 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1456751448 -32400
#      Mon Feb 29 22:10:48 2016 +0900
# Node ID d19490b6a3b411b1c5321949c57ea4cc2b4fcd36
# Parent  4edd04c9b8c3a00bab9b11e77b32792dfe38c6c8
revset: unindent codes in _getalias() function

We generally do return early if tree isn't a tuple.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2260,18 +2260,18 @@ def _getalias(aliases, tree):
     """If tree looks like an unexpanded alias, return it. Return None
     otherwise.
     """
-    if isinstance(tree, tuple):
-        if tree[0] == 'symbol':
-            name = tree[1]
-            alias = aliases.get(name)
-            if alias and alias.args is None and alias.tree == tree:
-                return alias
-        if tree[0] == 'func':
-            if tree[1][0] == 'symbol':
-                name = tree[1][1]
-                alias = aliases.get(name)
-                if alias and alias.args is not None and alias.tree == tree[:2]:
-                    return alias
+    if not isinstance(tree, tuple):
+        return None
+    if tree[0] == 'symbol':
+        name = tree[1]
+        alias = aliases.get(name)
+        if alias and alias.args is None and alias.tree == tree:
+            return alias
+    if tree[0] == 'func' and tree[1][0] == 'symbol':
+        name = tree[1][1]
+        alias = aliases.get(name)
+        if alias and alias.args is not None and alias.tree == tree[:2]:
+            return alias
     return None
 
 def _expandargs(tree, args):


More information about the Mercurial-devel mailing list