revset: narrow scope of "except ParseError" block in _parsealiasdecl()
authorYuya Nishihara <yuya@tcha.org>
Mon, 29 Feb 2016 17:43:39 +0900
changeset 28869 f8182ab688a5
parent 28868 445a25bb70be
child 28870 475dad3432fd
revset: narrow scope of "except ParseError" block in _parsealiasdecl() This helps to factor out a common function. "if True" will be removed soon.
mercurial/revset.py
--- a/mercurial/revset.py	Tue Apr 12 04:06:50 2016 -0700
+++ b/mercurial/revset.py	Mon Feb 29 17:43:39 2016 +0900
@@ -2279,7 +2279,10 @@
         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]
@@ -2303,8 +2306,6 @@
             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):