Show More
@@ -18,6 +18,37 b' from mercurial import (' | |||||
18 | revsetpredicate = registrar.revsetpredicate() |
|
18 | revsetpredicate = registrar.revsetpredicate() | |
19 |
|
19 | |||
20 |
|
20 | |||
|
21 | @revsetpredicate(b'subsetspec("<spec>")') | |||
|
22 | def subsetmarkerspec(repo, subset, x): | |||
|
23 | """use a shorthand spec as used by search-discovery-case | |||
|
24 | ||||
|
25 | Supported format are: | |||
|
26 | ||||
|
27 | - "scratch-count-seed": not scratch(all(), count, "seed") | |||
|
28 | - "randomantichain-seed": ::randomantichain(all(), "seed") | |||
|
29 | - "rev-REV": "::REV" | |||
|
30 | """ | |||
|
31 | args = revsetlang.getargs( | |||
|
32 | x, 0, 1, _(b'subsetspec("spec") required an argument') | |||
|
33 | ) | |||
|
34 | ||||
|
35 | spec = revsetlang.getstring(args[0], _(b"spec should be a string")) | |||
|
36 | case = spec.split(b'-') | |||
|
37 | t = case[0] | |||
|
38 | if t == b'scratch': | |||
|
39 | spec_revset = b'not scratch(all(), %s, "%s")' % (case[1], case[2]) | |||
|
40 | elif t == b'randomantichain': | |||
|
41 | spec_revset = b'::randomantichain(all(), "%s")' % case[1] | |||
|
42 | elif t == b'rev': | |||
|
43 | spec_revset = b'::%d' % case[1] | |||
|
44 | else: | |||
|
45 | assert False, spec | |||
|
46 | ||||
|
47 | selected = repo.revs(spec_revset) | |||
|
48 | ||||
|
49 | return selected & subset | |||
|
50 | ||||
|
51 | ||||
21 | @revsetpredicate(b'scratch(REVS, <count>, [seed])') |
|
52 | @revsetpredicate(b'scratch(REVS, <count>, [seed])') | |
22 | def scratch(repo, subset, x): |
|
53 | def scratch(repo, subset, x): | |
23 | """randomly remove <count> revision from the repository top |
|
54 | """randomly remove <count> revision from the repository top |
General Comments 0
You need to be logged in to leave comments.
Login now