Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
scmperf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
scmperf
Commits
de5e038152f6
Commit
de5e038152f6
authored
5 years ago
by
Pierre-Yves David
Browse files
Options
Downloads
Patches
Plain Diff
revision-tests: extract an explicite `self._matchrevset` method
This can be useful in other context.
parent
4cd348cbe39a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/utils.py
+26
-26
26 additions, 26 deletions
benchmarks/utils.py
with
26 additions
and
26 deletions
benchmarks/utils.py
+
26
−
26
View file @
de5e0381
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment