contrib/revsetbenchmarks.py
changeset 20893 b5de9dde181c
parent 20855 dfad9bb23ab4
child 21202 c04e5e937139
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)])