From patchwork Wed Apr 13 15:55:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,7] revset: unindent codes in _getalias() function From: Yuya Nishihara X-Patchwork-Id: 14582 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Thu, 14 Apr 2016 00:55:15 +0900 # HG changeset patch # User Yuya Nishihara # 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):