Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 30753:c3a3896a9fa8
parser: extend buildargsdict() to support variable-length positional args
This can simplify the argument parsing of followlines(). Tests are added by
the next patch.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 09 Jan 2017 15:25:52 +0900 |
parents | 42c75b4fa46a |
children | 26209cb7184e |
comparison
equal
deleted
inserted
replaced
30752:ffd324eaf994 | 30753:c3a3896a9fa8 |
---|---|
324 if len(l) < min or (max >= 0 and len(l) > max): | 324 if len(l) < min or (max >= 0 and len(l) > max): |
325 raise error.ParseError(err) | 325 raise error.ParseError(err) |
326 return l | 326 return l |
327 | 327 |
328 def getargsdict(x, funcname, keys): | 328 def getargsdict(x, funcname, keys): |
329 return parser.buildargsdict(getlist(x), funcname, keys.split(), | 329 return parser.buildargsdict(getlist(x), funcname, parser.splitargspec(keys), |
330 keyvaluenode='keyvalue', keynode='symbol') | 330 keyvaluenode='keyvalue', keynode='symbol') |
331 | 331 |
332 def getset(repo, subset, x): | 332 def getset(repo, subset, x): |
333 if not x: | 333 if not x: |
334 raise error.ParseError(_("missing argument")) | 334 raise error.ParseError(_("missing argument")) |