Mercurial > hg
comparison contrib/revsetbenchmarks.py @ 20893:b5de9dde181c
revsetbenchmark: remove python 2.7 dependency
revsetbenchmark.py used check_output which only exists in python 2.7. This
fixes it.
author | Durham Goode <durham@fb.com> |
---|---|
date | Mon, 31 Mar 2014 16:29:39 -0700 |
parents | dfad9bb23ab4 |
children | c04e5e937139 |
comparison
equal
deleted
inserted
replaced
20892:6fe95448596d | 20893:b5de9dde181c |
---|---|
12 # | 12 # |
13 # This script also does one run of the current version of mercurial installed | 13 # This script also does one run of the current version of mercurial installed |
14 # to compare performance. | 14 # to compare performance. |
15 | 15 |
16 import sys | 16 import sys |
17 from subprocess import check_call, check_output, CalledProcessError, STDOUT | 17 from subprocess import check_call, Popen, CalledProcessError, STDOUT, PIPE |
18 | 18 |
19 def check_output(*args, **kwargs): | |
20 kwargs.setdefault('stderr', PIPE) | |
21 kwargs.setdefault('stdout', PIPE) | |
22 proc = Popen(*args, **kwargs) | |
23 output, error = proc.communicate() | |
24 if proc.returncode != 0: | |
25 raise CalledProcessError(proc.returncode, ' '.join(args)) | |
26 return output | |
19 | 27 |
20 def update(rev): | 28 def update(rev): |
21 """update the repo to a revision""" | 29 """update the repo to a revision""" |
22 try: | 30 try: |
23 check_call(['hg', 'update', '--quiet', '--check', str(rev)]) | 31 check_call(['hg', 'update', '--quiet', '--check', str(rev)]) |