Mercurial > hg
changeset 21549:ea3d75ebea6d
revsetbenchmark: support for running on other repo
We add a -R/--repo option to run the benchmarks on another repository. This is
very useful as some repository are bigger/more interesting than the mercurial one.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 29 Apr 2014 14:12:32 -0700 |
parents | 651d7548a744 |
children | b4f0e15d1dab |
files | contrib/revsetbenchmarks.py |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/revsetbenchmarks.py Tue Apr 29 13:18:22 2014 -0700 +++ b/contrib/revsetbenchmarks.py Tue Apr 29 14:12:32 2014 -0700 @@ -38,16 +38,19 @@ print >> sys.stderr, 'update to revision %s failed, aborting' % rev sys.exit(exc.returncode) -def perf(revset): +def perf(revset, target=None): """run benchmark for this very revset""" try: - output = check_output(['./hg', - '--config', - 'extensions.perf=' - + os.path.join(contribdir, 'perf.py'), - 'perfrevset', - revset], - stderr=STDOUT) + cmd = ['./hg', + '--config', + 'extensions.perf=' + + os.path.join(contribdir, 'perf.py'), + 'perfrevset', + revset] + if target is not None: + cmd.append('-R') + cmd.append(target) + output = check_output(cmd, stderr=STDOUT) output = output.lstrip('!') # remove useless ! in this context return output.strip() except CalledProcessError, exc: @@ -74,6 +77,8 @@ parser = OptionParser(usage="usage: %prog [options] <revs>") parser.add_option("-f", "--file", help="read revset from FILE", metavar="FILE") +parser.add_option("-R", "--repo", + help="run benchmark on REPO", metavar="REPO") (options, args) = parser.parse_args() @@ -113,7 +118,7 @@ res = [] results.append(res) for idx, rset in enumerate(revsets): - data = perf(rset) + data = perf(rset, target=options.repo) res.append(data) print "%i)" % idx, data sys.stdout.flush()