Show More
@@ -466,6 +466,24 b' def draft(repo, subset, x):' | |||||
466 | pc = repo._phasecache |
|
466 | pc = repo._phasecache | |
467 | return [r for r in subset if pc.phase(repo, r) == phases.draft] |
|
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 | def filelog(repo, subset, x): |
|
487 | def filelog(repo, subset, x): | |
470 | """``filelog(pattern)`` |
|
488 | """``filelog(pattern)`` | |
471 | Changesets connected to the specified filelog. |
|
489 | Changesets connected to the specified filelog. | |
@@ -1147,6 +1165,7 b' symbols = {' | |||||
1147 | "descendants": descendants, |
|
1165 | "descendants": descendants, | |
1148 | "_firstdescendants": _firstdescendants, |
|
1166 | "_firstdescendants": _firstdescendants, | |
1149 | "draft": draft, |
|
1167 | "draft": draft, | |
|
1168 | "extra": extra, | |||
1150 | "file": hasfile, |
|
1169 | "file": hasfile, | |
1151 | "filelog": filelog, |
|
1170 | "filelog": filelog, | |
1152 | "first": first, |
|
1171 | "first": first, |
@@ -32,6 +32,13 b'' | |||||
32 | (branches are permanent and global, did you want a bookmark?) |
|
32 | (branches are permanent and global, did you want a bookmark?) | |
33 | $ hg ci -Aqm2 -u Bob |
|
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 | $ hg co 1 |
|
42 | $ hg co 1 | |
36 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
43 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
37 | $ hg branch +a+b+c+ |
|
44 | $ hg branch +a+b+c+ |
General Comments 0
You need to be logged in to leave comments.
Login now