revsetbenchmark: convert revision display to proper subprocesscall
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 26 Mar 2014 18:27:17 -0700
changeset 20852 b2353501d6dc
parent 20851 4130ec938c84
child 20853 95293cf67871
revsetbenchmark: convert revision display to proper subprocesscall
contrib/revsetbenchmarks.py
--- a/contrib/revsetbenchmarks.py	Wed Mar 26 18:26:18 2014 -0700
+++ b/contrib/revsetbenchmarks.py	Wed Mar 26 18:27:17 2014 -0700
@@ -34,6 +34,13 @@
         print >> sys.stderr, 'abort: cannot run revset benchmark'
         sys.exit(exc.returncode)
 
+def printrevision(rev):
+    """print data about a revision"""
+    sys.stdout.write("Revision: ")
+    sys.stdout.flush()
+    check_call(['hg', 'log', '--rev', str(rev), '--template',
+               '{desc|firstline}\n'])
+
 
 target_rev = sys.argv[1]
 
@@ -60,10 +67,7 @@
 # Benchmark revisions
 for r in revs:
     print "----------------------------"
-    sys.stdout.write("Revision: ")
-    sys.stdout.flush()
-    check_call('hg log -r %s --template "{desc|firstline}\n"' % r, shell=True)
-
+    printrevision(r)
     print "----------------------------"
     update(r)
     for idx, rset in enumerate(revsets):