Skip to content
Snippets Groups Projects
Commit de5e038152f6 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

revision-tests: extract an explicite `self._matchrevset` method

This can be useful in other context.
parent 4cd348cbe39a
No related branches found
No related tags found
No related merge requests found
......@@ -347,6 +347,31 @@
)
raise
def _matchrevset(self, revset, target_rev):
"""return True if <target-rev> is within <revset>"""
tmpl = "({}) and ({})"
full_revset = tmpl.format(revset, target_rev)
match_pattern = 'ASV-REVSET-MATCH'
# TODO use `hg test` if/when it is stable
command = [
self.hgpath,
'--cwd',
os.path.join(BASEDIR, "mercurial"),
'log',
'-r',
full_revset,
'-T',
match_pattern
]
try:
output = self.check_output(*command, env=self.environ)
except subprocess.CalledProcessError as exc:
if exc.returncode == 255:
return False
else:
raise
return match_pattern in output
def should_skip_benchmark(self, incompatibility_revset, current_version, filter_fn, test_kwargs):
"""Determines whether the benchmark should be run given an exclusion
revset, the current mercurial version and an optional filter function.
......@@ -359,32 +384,7 @@
in_filter = False
if incompatibility_revset is not None and current_version:
tmpl = "{} & {}"
full_revset = tmpl.format(incompatibility_revset, current_version)
match_pattern = 'ASV_REVSET_MATCH'
# TODO use `hg test` when it's stable
command = [
self.hgpath,
'--cwd',
os.path.join(BASEDIR, "mercurial"),
'log',
'-r',
full_revset,
'-T',
match_pattern
]
try:
output = self.check_output(*command, env=self.environ)
except subprocess.CalledProcessError as exc:
if exc.returncode == 255:
in_revset = False
else:
raise
else:
if not match_pattern in output:
in_revset = False
in_revset = self._matchrevset(incompatibility_revset, current_version)
in_filter = True
if filter_fn is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment