Skip to content

Commit 5577c0c

Browse files
committed
Merge pull request #4392 from cpcloud/test_perf-rev-parse
ENH: add git names to test_perf.py
2 parents 0d80c79 + 7800fd4 commit 5577c0c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

vb_suite/test_perf.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@
4545
HEAD_COL="head[ms]"
4646
BASE_COL="base[ms]"
4747

48+
49+
class RevParseAction(argparse.Action):
50+
def __call__(self, parser, namespace, values, option_string=None):
51+
import subprocess
52+
cmd = 'git rev-parse {0}'.format(values)
53+
rev_parse = subprocess.check_output(cmd, shell=True)
54+
setattr(namespace, self.dest, rev_parse.strip())
55+
56+
4857
parser = argparse.ArgumentParser(description='Use vbench to measure and compare the performance of commits.')
4958
parser.add_argument('-H', '--head',
5059
help='Execute vbenches using the currently checked out copy.',
@@ -53,10 +62,10 @@
5362
default=False)
5463
parser.add_argument('-b', '--base-commit',
5564
help='The commit serving as performance baseline ',
56-
type=str)
65+
type=str, action=RevParseAction)
5766
parser.add_argument('-t', '--target-commit',
5867
help='The commit to compare against the baseline (default: HEAD).',
59-
type=str)
68+
type=str, action=RevParseAction)
6069
parser.add_argument('-m', '--min-duration',
6170
help='Minimum duration (in ms) of baseline test for inclusion in report (default: %.3f).' % DEFAULT_MIN_DURATION,
6271
type=float,

0 commit comments

Comments
 (0)