Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 28869:f8182ab688a5
revset: narrow scope of "except ParseError" block in _parsealiasdecl()
This helps to factor out a common function. "if True" will be removed soon.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 29 Feb 2016 17:43:39 +0900 |
parents | 69c6e9623bdc |
children | 475dad3432fd |
comparison
equal
deleted
inserted
replaced
28868:445a25bb70be | 28869:f8182ab688a5 |
---|---|
2277 try: | 2277 try: |
2278 tree, pos = p.parse(_tokenizealias(decl)) | 2278 tree, pos = p.parse(_tokenizealias(decl)) |
2279 if (pos != len(decl)): | 2279 if (pos != len(decl)): |
2280 raise error.ParseError(_('invalid token'), pos) | 2280 raise error.ParseError(_('invalid token'), pos) |
2281 tree = parser.simplifyinfixops(tree, ('list',)) | 2281 tree = parser.simplifyinfixops(tree, ('list',)) |
2282 | 2282 except error.ParseError as inst: |
2283 return (decl, None, None, parser.parseerrordetail(inst)) | |
2284 | |
2285 if True: # XXX to be removed | |
2283 if tree[0] == 'symbol': | 2286 if tree[0] == 'symbol': |
2284 # "name = ...." style | 2287 # "name = ...." style |
2285 name = tree[1] | 2288 name = tree[1] |
2286 if name.startswith('$'): | 2289 if name.startswith('$'): |
2287 return (decl, None, None, _("'$' not for alias arguments")) | 2290 return (decl, None, None, _("'$' not for alias arguments")) |
2301 return (name, None, None, | 2304 return (name, None, None, |
2302 _("argument names collide with each other")) | 2305 _("argument names collide with each other")) |
2303 return (name, tree[:2], args, None) | 2306 return (name, tree[:2], args, None) |
2304 | 2307 |
2305 return (decl, None, None, _("invalid format")) | 2308 return (decl, None, None, _("invalid format")) |
2306 except error.ParseError as inst: | |
2307 return (decl, None, None, parser.parseerrordetail(inst)) | |
2308 | 2309 |
2309 def _relabelaliasargs(tree, args): | 2310 def _relabelaliasargs(tree, args): |
2310 if not isinstance(tree, tuple): | 2311 if not isinstance(tree, tuple): |
2311 return tree | 2312 return tree |
2312 op = tree[0] | 2313 op = tree[0] |