##// END OF EJS Templates
revset: add function for matching extra data (issue2767)
Henrik Stuart -
r16661:de4b42da default
parent child Browse files
Show More
@@ -466,6 +466,24 b' def draft(repo, subset, x):'
466 466 pc = repo._phasecache
467 467 return [r for r in subset if pc.phase(repo, r) == phases.draft]
468 468
469 def extra(repo, subset, x):
470 """``extra(label, [value])``
471 Changesets with the given label in the extra metadata, with the given
472 optional value."""
473
474 l = getargs(x, 1, 2, _('extra takes at least 1 and at most 2 arguments'))
475 label = getstring(l[0], _('first argument to extra must be a string'))
476 value = None
477
478 if len(l) > 1:
479 value = getstring(l[1], _('second argument to extra must be a string'))
480
481 def _matchvalue(r):
482 extra = repo[r].extra()
483 return label in extra and (value is None or value == extra[label])
484
485 return [r for r in subset if _matchvalue(r)]
486
469 487 def filelog(repo, subset, x):
470 488 """``filelog(pattern)``
471 489 Changesets connected to the specified filelog.
@@ -1147,6 +1165,7 b' symbols = {'
1147 1165 "descendants": descendants,
1148 1166 "_firstdescendants": _firstdescendants,
1149 1167 "draft": draft,
1168 "extra": extra,
1150 1169 "file": hasfile,
1151 1170 "filelog": filelog,
1152 1171 "first": first,
@@ -32,6 +32,13 b''
32 32 (branches are permanent and global, did you want a bookmark?)
33 33 $ hg ci -Aqm2 -u Bob
34 34
35 $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
36 2
37 $ hg log -r "extra('branch')" --template '{rev}\n'
38 0
39 1
40 2
41
35 42 $ hg co 1
36 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 44 $ hg branch +a+b+c+
General Comments 0
You need to be logged in to leave comments. Login now