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

login
register
mail settings
Submitter Yuya Nishihara
Date April 13, 2016, 3:55 p.m.
Message ID <d19490b6a3b411b1c532.1460562915@mimosa>
Download mbox | patch
Permalink /patch/14582/
State Accepted
Commit 0f59674dc9ffd2e336462c0013e15b5fbbc3b439
Headers show

Comments

Yuya Nishihara - April 13, 2016, 3:55 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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):