# HG changeset patch # User Pierre-Yves David # Date 2021-03-16 11:52:23 # Node ID 63a3941d9847e954c086ff349c4ba7ecc71cfad1 # Parent 6b26e64325544f56d2089a7613e5be4ffb7318fc perf-util: add an helper revset to use the same spec as the case search script This make result of the searcher script easier to use. Differential Revision: https://phab.mercurial-scm.org/D10228 diff --git a/contrib/perf-utils/subsetmaker.py b/contrib/perf-utils/subsetmaker.py --- a/contrib/perf-utils/subsetmaker.py +++ b/contrib/perf-utils/subsetmaker.py @@ -18,6 +18,37 @@ from mercurial import ( revsetpredicate = registrar.revsetpredicate() +@revsetpredicate(b'subsetspec("")') +def subsetmarkerspec(repo, subset, x): + """use a shorthand spec as used by search-discovery-case + + Supported format are: + + - "scratch-count-seed": not scratch(all(), count, "seed") + - "randomantichain-seed": ::randomantichain(all(), "seed") + - "rev-REV": "::REV" + """ + args = revsetlang.getargs( + x, 0, 1, _(b'subsetspec("spec") required an argument') + ) + + spec = revsetlang.getstring(args[0], _(b"spec should be a string")) + case = spec.split(b'-') + t = case[0] + if t == b'scratch': + spec_revset = b'not scratch(all(), %s, "%s")' % (case[1], case[2]) + elif t == b'randomantichain': + spec_revset = b'::randomantichain(all(), "%s")' % case[1] + elif t == b'rev': + spec_revset = b'::%d' % case[1] + else: + assert False, spec + + selected = repo.revs(spec_revset) + + return selected & subset + + @revsetpredicate(b'scratch(REVS, , [seed])') def scratch(repo, subset, x): """randomly remove revision from the repository top