500 return [r for r in subset if pc.phase(repo, r) == phases.draft] |
500 return [r for r in subset if pc.phase(repo, r) == phases.draft] |
501 |
501 |
502 def extra(repo, subset, x): |
502 def extra(repo, subset, x): |
503 """``extra(label, [value])`` |
503 """``extra(label, [value])`` |
504 Changesets with the given label in the extra metadata, with the given |
504 Changesets with the given label in the extra metadata, with the given |
505 optional value.""" |
505 optional value. |
|
506 |
|
507 If `value` starts with `re:`, the remainder of the value is treated as |
|
508 a regular expression. To match a value that actually starts with `re:`, |
|
509 use the prefix `literal:`. |
|
510 """ |
506 |
511 |
507 l = getargs(x, 1, 2, _('extra takes at least 1 and at most 2 arguments')) |
512 l = getargs(x, 1, 2, _('extra takes at least 1 and at most 2 arguments')) |
508 label = getstring(l[0], _('first argument to extra must be a string')) |
513 label = getstring(l[0], _('first argument to extra must be a string')) |
509 value = None |
514 value = None |
510 |
515 |
511 if len(l) > 1: |
516 if len(l) > 1: |
512 value = getstring(l[1], _('second argument to extra must be a string')) |
517 value = getstring(l[1], _('second argument to extra must be a string')) |
|
518 kind, value, matcher = _stringmatcher(value) |
513 |
519 |
514 def _matchvalue(r): |
520 def _matchvalue(r): |
515 extra = repo[r].extra() |
521 extra = repo[r].extra() |
516 return label in extra and (value is None or value == extra[label]) |
522 return label in extra and (value is None or matcher(extra[label])) |
517 |
523 |
518 return [r for r in subset if _matchvalue(r)] |
524 return [r for r in subset if _matchvalue(r)] |
519 |
525 |
520 def filelog(repo, subset, x): |
526 def filelog(repo, subset, x): |
521 """``filelog(pattern)`` |
527 """``filelog(pattern)`` |