Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 25767:026105c442d7
revset: rename getkwargs() to getargsdict()
This function was added recently at 48919d246a47, but its name was misleading
because it processes both positional and keyword arguments.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 02 Jul 2015 21:39:31 +0900 |
parents | d51dac68ec98 |
children | f8f7ae0f4d98 |
comparison
equal
deleted
inserted
replaced
25766:d51dac68ec98 | 25767:026105c442d7 |
---|---|
280 l = getlist(x) | 280 l = getlist(x) |
281 if len(l) < min or (max >= 0 and len(l) > max): | 281 if len(l) < min or (max >= 0 and len(l) > max): |
282 raise error.ParseError(err) | 282 raise error.ParseError(err) |
283 return l | 283 return l |
284 | 284 |
285 def getkwargs(x, funcname, keys): | 285 def getargsdict(x, funcname, keys): |
286 return parser.buildargsdict(getlist(x), funcname, keys.split(), | 286 return parser.buildargsdict(getlist(x), funcname, keys.split(), |
287 keyvaluenode='keyvalue', keynode='symbol') | 287 keyvaluenode='keyvalue', keynode='symbol') |
288 | 288 |
289 def isvalidsymbol(tree): | 289 def isvalidsymbol(tree): |
290 """Examine whether specified ``tree`` is valid ``symbol`` or not | 290 """Examine whether specified ``tree`` is valid ``symbol`` or not |
844 | 844 |
845 If `value` starts with `re:`, the remainder of the value is treated as | 845 If `value` starts with `re:`, the remainder of the value is treated as |
846 a regular expression. To match a value that actually starts with `re:`, | 846 a regular expression. To match a value that actually starts with `re:`, |
847 use the prefix `literal:`. | 847 use the prefix `literal:`. |
848 """ | 848 """ |
849 args = getkwargs(x, 'extra', 'label value') | 849 args = getargsdict(x, 'extra', 'label value') |
850 if 'label' not in args: | 850 if 'label' not in args: |
851 # i18n: "extra" is a keyword | 851 # i18n: "extra" is a keyword |
852 raise error.ParseError(_('extra takes at least 1 argument')) | 852 raise error.ParseError(_('extra takes at least 1 argument')) |
853 # i18n: "extra" is a keyword | 853 # i18n: "extra" is a keyword |
854 label = getstring(args['label'], _('first argument to extra must be ' | 854 label = getstring(args['label'], _('first argument to extra must be ' |