Mercurial > evolve
comparison src/topic/revset.py @ 1870:8dd5200b4086
topic: introduce a 'ngtip' concept
The concept is to be massively used in naming and default destination logic.
The name is horrible so that people find a better one.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 21 Oct 2015 01:12:32 +0200 |
parents | 558dd43b599d |
children |
comparison
equal
deleted
inserted
replaced
1869:995617c7f2fc | 1870:8dd5200b4086 |
---|---|
1 from mercurial import revset | 1 from mercurial import revset |
2 from mercurial import util | 2 from mercurial import util |
3 | 3 |
4 from . import constants | 4 from . import constants, destination |
5 | 5 |
6 try: | 6 try: |
7 mkmatcher = revset._stringmatcher | 7 mkmatcher = revset._stringmatcher |
8 except AttributeError: | 8 except AttributeError: |
9 mkmatcher = util.stringmatcher | 9 mkmatcher = util.stringmatcher |
29 matcher = lambda t: bool(t) | 29 matcher = lambda t: bool(t) |
30 drafts = subset.filter(lambda r: repo[r].mutable()) | 30 drafts = subset.filter(lambda r: repo[r].mutable()) |
31 return drafts.filter( | 31 return drafts.filter( |
32 lambda r: matcher(repo[r].extra().get(constants.extrakey, ''))) | 32 lambda r: matcher(repo[r].extra().get(constants.extrakey, ''))) |
33 | 33 |
34 def ngtipset(repo, subset, x): | |
35 """`ngtip([branch])` | |
36 | |
37 The untopiced tip. | |
38 | |
39 Name is horrible so that people change it. | |
40 """ | |
41 args = revset.getargs(x, 1, 1, 'topic takes one') | |
42 # match a specific topic | |
43 branch = revset.getstring(args[0], 'ngtip() argument must be a string') | |
44 if branch == '.': | |
45 branch = repo['.'].branch() | |
46 return subset & destination.ngtip(repo, branch) | |
47 | |
34 def modsetup(): | 48 def modsetup(): |
35 revset.symbols.update({'topic': topicset}) | 49 revset.symbols.update({'topic': topicset}) |
50 revset.symbols.update({'ngtip': ngtipset}) |