Show More
@@ -38,16 +38,19 b' def update(rev):' | |||||
38 | print >> sys.stderr, 'update to revision %s failed, aborting' % rev |
|
38 | print >> sys.stderr, 'update to revision %s failed, aborting' % rev | |
39 | sys.exit(exc.returncode) |
|
39 | sys.exit(exc.returncode) | |
40 |
|
40 | |||
41 | def perf(revset): |
|
41 | def perf(revset, target=None): | |
42 | """run benchmark for this very revset""" |
|
42 | """run benchmark for this very revset""" | |
43 | try: |
|
43 | try: | |
44 |
|
|
44 | cmd = ['./hg', | |
45 |
|
|
45 | '--config', | |
46 |
|
|
46 | 'extensions.perf=' | |
47 |
|
|
47 | + os.path.join(contribdir, 'perf.py'), | |
48 |
|
|
48 | 'perfrevset', | |
49 |
|
|
49 | revset] | |
50 | stderr=STDOUT) |
|
50 | if target is not None: | |
|
51 | cmd.append('-R') | |||
|
52 | cmd.append(target) | |||
|
53 | output = check_output(cmd, stderr=STDOUT) | |||
51 | output = output.lstrip('!') # remove useless ! in this context |
|
54 | output = output.lstrip('!') # remove useless ! in this context | |
52 | return output.strip() |
|
55 | return output.strip() | |
53 | except CalledProcessError, exc: |
|
56 | except CalledProcessError, exc: | |
@@ -74,6 +77,8 b' def getrevs(spec):' | |||||
74 | parser = OptionParser(usage="usage: %prog [options] <revs>") |
|
77 | parser = OptionParser(usage="usage: %prog [options] <revs>") | |
75 | parser.add_option("-f", "--file", |
|
78 | parser.add_option("-f", "--file", | |
76 | help="read revset from FILE", metavar="FILE") |
|
79 | help="read revset from FILE", metavar="FILE") | |
|
80 | parser.add_option("-R", "--repo", | |||
|
81 | help="run benchmark on REPO", metavar="REPO") | |||
77 |
|
82 | |||
78 | (options, args) = parser.parse_args() |
|
83 | (options, args) = parser.parse_args() | |
79 |
|
84 | |||
@@ -113,7 +118,7 b' for r in revs:' | |||||
113 | res = [] |
|
118 | res = [] | |
114 | results.append(res) |
|
119 | results.append(res) | |
115 | for idx, rset in enumerate(revsets): |
|
120 | for idx, rset in enumerate(revsets): | |
116 | data = perf(rset) |
|
121 | data = perf(rset, target=options.repo) | |
117 | res.append(data) |
|
122 | res.append(data) | |
118 | print "%i)" % idx, data |
|
123 | print "%i)" % idx, data | |
119 | sys.stdout.flush() |
|
124 | sys.stdout.flush() |
General Comments 0
You need to be logged in to leave comments.
Login now