contrib/revsetbenchmarks.py
changeset 20852 b2353501d6dc
parent 20851 4130ec938c84
child 20853 95293cf67871
equal deleted inserted replaced
20851:4130ec938c84 20852:b2353501d6dc
    32                     'perfrevset', revset])
    32                     'perfrevset', revset])
    33     except CalledProcessError, exc:
    33     except CalledProcessError, exc:
    34         print >> sys.stderr, 'abort: cannot run revset benchmark'
    34         print >> sys.stderr, 'abort: cannot run revset benchmark'
    35         sys.exit(exc.returncode)
    35         sys.exit(exc.returncode)
    36 
    36 
       
    37 def printrevision(rev):
       
    38     """print data about a revision"""
       
    39     sys.stdout.write("Revision: ")
       
    40     sys.stdout.flush()
       
    41     check_call(['hg', 'log', '--rev', str(rev), '--template',
       
    42                '{desc|firstline}\n'])
       
    43 
    37 
    44 
    38 target_rev = sys.argv[1]
    45 target_rev = sys.argv[1]
    39 
    46 
    40 revsetsfile = sys.stdin
    47 revsetsfile = sys.stdin
    41 if len(sys.argv) > 2:
    48 if len(sys.argv) > 2:
    58 revs = [r for r in revs.split() if r]
    65 revs = [r for r in revs.split() if r]
    59 
    66 
    60 # Benchmark revisions
    67 # Benchmark revisions
    61 for r in revs:
    68 for r in revs:
    62     print "----------------------------"
    69     print "----------------------------"
    63     sys.stdout.write("Revision: ")
    70     printrevision(r)
    64     sys.stdout.flush()
       
    65     check_call('hg log -r %s --template "{desc|firstline}\n"' % r, shell=True)
       
    66 
       
    67     print "----------------------------"
    71     print "----------------------------"
    68     update(r)
    72     update(r)
    69     for idx, rset in enumerate(revsets):
    73     for idx, rset in enumerate(revsets):
    70         sys.stdout.write("%i) " % idx)
    74         sys.stdout.write("%i) " % idx)
    71         sys.stdout.flush()
    75         sys.stdout.flush()