[PATCH 1 of 7 V2] revset: narrow scope of "except ParseError" block in _parsealiasdecl()
Yuya Nishihara
yuya at tcha.org
Sat Apr 2 08:30:16 UTC 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1456735419 -32400
# Mon Feb 29 17:43:39 2016 +0900
# Node ID e2db714a290c5ae731b542011a33961bd631968a
# Parent 56101c3d7302aab803c2d72f6ffbe4ee0df79e49
revset: narrow scope of "except ParseError" block in _parsealiasdecl()
This helps to factor out a common function. "if True" will be removed soon.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2283,7 +2283,10 @@ def _parsealiasdecl(decl):
if (pos != len(decl)):
raise error.ParseError(_('invalid token'), pos)
tree = parser.simplifyinfixops(tree, ('list',))
-
+ except error.ParseError as inst:
+ return (decl, None, None, parser.parseerrordetail(inst))
+
+ if True: # XXX to be removed
if tree[0] == 'symbol':
# "name = ...." style
name = tree[1]
@@ -2307,8 +2310,6 @@ def _parsealiasdecl(decl):
return (name, tree[:2], args, None)
return (decl, None, None, _("invalid format"))
- except error.ParseError as inst:
- return (decl, None, None, parser.parseerrordetail(inst))
def _relabelaliasargs(tree, args):
if not isinstance(tree, tuple):
More information about the Mercurial-devel
mailing list