contrib/revsetbenchmarks.py
changeset 21549 ea3d75ebea6d
parent 21548 651d7548a744
child 22059 d5cef58d8ec8
--- 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()