equal
deleted
inserted
replaced
|
1 from mercurial import revset |
|
2 |
|
3 def topicset(repo, subset, x): |
|
4 """`topic([topic])` |
|
5 Specified topic or all changes with any topic specified. |
|
6 |
|
7 If `topic` starts with `re:` the remainder of the name is treated |
|
8 as a regular expression. |
|
9 |
|
10 TODO: make `topic(revset)` work the same as `branch(revset)`. |
|
11 """ |
|
12 args = revset.getargs(x, 0, 1, 'topic takes one or no arguments') |
|
13 if args: |
|
14 # match a specific topic |
|
15 topic = revset.getstring(args[0], 'topic() argument must be a string') |
|
16 _kind, _pattern, matcher = revset._stringmatcher(topic) |
|
17 else: |
|
18 matcher = lambda t: bool(t) |
|
19 drafts = subset.filter(lambda r: repo[r].mutable()) |
|
20 return drafts.filter(lambda r: matcher(repo[r].extra().get('topic', ''))) |
|
21 |
|
22 def modsetup(): |
|
23 revset.symbols.update({'topic': topicset}) |