Show More
@@ -840,16 +840,19 b' def extra(repo, subset, x):' | |||
|
840 | 840 | a regular expression. To match a value that actually starts with `re:`, |
|
841 | 841 | use the prefix `literal:`. |
|
842 | 842 | """ |
|
843 | ||
|
844 | # i18n: "extra" is a keyword | |
|
845 | l = getargs(x, 1, 2, _('extra takes at least 1 and at most 2 arguments')) | |
|
843 | args = getkwargs(x, 'extra', 'label value') | |
|
844 | if 'label' not in args: | |
|
845 | # i18n: "extra" is a keyword | |
|
846 | raise error.ParseError(_('extra takes at least 1 argument')) | |
|
846 | 847 | # i18n: "extra" is a keyword |
|
847 |
label = getstring( |
|
|
848 | label = getstring(args['label'], _('first argument to extra must be ' | |
|
849 | 'a string')) | |
|
848 | 850 | value = None |
|
849 | 851 | |
|
850 | if len(l) > 1: | |
|
852 | if 'value' in args: | |
|
851 | 853 | # i18n: "extra" is a keyword |
|
852 |
value = getstring( |
|
|
854 | value = getstring(args['value'], _('second argument to extra must be ' | |
|
855 | 'a string')) | |
|
853 | 856 | kind, value, matcher = _stringmatcher(value) |
|
854 | 857 | |
|
855 | 858 | def _matchvalue(r): |
@@ -324,6 +324,25 b' quoting needed' | |||
|
324 | 324 | |
|
325 | 325 | keyword arguments |
|
326 | 326 | |
|
327 | $ log 'extra(branch, value=a)' | |
|
328 | 0 | |
|
329 | ||
|
330 | $ log 'extra(branch, a, b)' | |
|
331 | hg: parse error: extra takes at most 2 arguments | |
|
332 | [255] | |
|
333 | $ log 'extra(a, label=b)' | |
|
334 | hg: parse error: extra got multiple values for keyword argument 'label' | |
|
335 | [255] | |
|
336 | $ log 'extra(label=branch, default)' | |
|
337 | hg: parse error: extra got an invalid argument | |
|
338 | [255] | |
|
339 | $ log 'extra(branch, foo+bar=baz)' | |
|
340 | hg: parse error: extra got an invalid argument | |
|
341 | [255] | |
|
342 | $ log 'extra(unknown=branch)' | |
|
343 | hg: parse error: extra got an unexpected keyword argument 'unknown' | |
|
344 | [255] | |
|
345 | ||
|
327 | 346 | $ try 'foo=bar|baz' |
|
328 | 347 | (keyvalue |
|
329 | 348 | ('symbol', 'foo') |
General Comments 0
You need to be logged in to leave comments.
Login now