changeset 20852:b2353501d6dc

revsetbenchmark: convert revision display to proper subprocesscall
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 26 Mar 2014 18:27:17 -0700
parents 4130ec938c84
children 95293cf67871
files contrib/revsetbenchmarks.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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):