equal
deleted
inserted
replaced
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 import os |
17 from subprocess import check_call, Popen, CalledProcessError, STDOUT, PIPE |
18 from subprocess import check_call, Popen, CalledProcessError, STDOUT, PIPE |
18 # cannot use argparse, python 2.7 only |
19 # cannot use argparse, python 2.7 only |
19 from optparse import OptionParser |
20 from optparse import OptionParser |
20 |
21 |
21 |
22 |
40 def perf(revset): |
41 def perf(revset): |
41 """run benchmark for this very revset""" |
42 """run benchmark for this very revset""" |
42 try: |
43 try: |
43 output = check_output(['./hg', |
44 output = check_output(['./hg', |
44 '--config', |
45 '--config', |
45 'extensions.perf=contrib/perf.py', |
46 'extensions.perf=' |
|
47 + os.path.join(contribdir, 'perf.py'), |
46 'perfrevset', |
48 'perfrevset', |
47 revset], |
49 revset], |
48 stderr=STDOUT) |
50 stderr=STDOUT) |
49 output = output.lstrip('!') # remove useless ! in this context |
51 output = output.lstrip('!') # remove useless ! in this context |
50 return output.strip() |
52 return output.strip() |
77 |
79 |
78 if len(sys.argv) < 2: |
80 if len(sys.argv) < 2: |
79 parser.print_help() |
81 parser.print_help() |
80 sys.exit(255) |
82 sys.exit(255) |
81 |
83 |
|
84 # the directory where both this script and the perf.py extension live. |
|
85 contribdir = os.path.dirname(__file__) |
82 |
86 |
83 target_rev = args[0] |
87 target_rev = args[0] |
84 |
88 |
85 revsetsfile = sys.stdin |
89 revsetsfile = sys.stdin |
86 if options.file: |
90 if options.file: |