Mercurial > hg-stable
changeset 20850:d0c2535c7aba
revsetbenchmark: convert update to proper subprocess call
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 26 Mar 2014 18:14:15 -0700 |
parents | 5abc2562106a |
children | 4130ec938c84 |
files | contrib/revsetbenchmarks.py |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/revsetbenchmarks.py Thu Mar 27 16:52:24 2014 -0500 +++ b/contrib/revsetbenchmarks.py Wed Mar 26 18:14:15 2014 -0700 @@ -14,9 +14,17 @@ # to compare performance. import sys -from subprocess import check_call, check_output +from subprocess import check_call, check_output, CalledProcessError + -HG="hg update --quiet --check" +def update(rev): + """update the repo to a revision""" + try: + check_call(['hg', 'update', '--quiet', '--check', str(rev)]) + except CalledProcessError, exc: + print >> sys.stderr, 'update to revision %s failed, aborting' % rev + sys.exit(exc.returncode) + PERF="./hg --config extensions.perf=contrib/perf.py perfrevset" target_rev = sys.argv[1] @@ -49,7 +57,7 @@ check_call('hg log -r %s --template "{desc|firstline}\n"' % r, shell=True) print "----------------------------" - check_call(HG + ' ' + r, shell=True) + update(r) for idx, rset in enumerate(revsets): sys.stdout.write("%i) " % idx) sys.stdout.flush()