# HG changeset patch # User Pierre-Yves David # Date 1398802702 25200 # Node ID 651d7548a744fd8f47827131a0373a2658bdb19a # Parent cb0e28d619059cc23c734df8e23738da715aee33 revsetbenchmark: automatically finds the perf extension Before this changeset, you had to stand in the root of the mercurial repo to run the `revsetbenchmark.py` script. Otherwise, the perf extension would not be found a `./contrib/perf.py` and the script would crash in panic. We now figure out the contrib directory from the location of this script. This makes it possible to run the script from other location that the mercurial repo root (but you still need to be in the core mercurial repository) diff -r cb0e28d61905 -r 651d7548a744 contrib/revsetbenchmarks.py --- a/contrib/revsetbenchmarks.py Mon May 19 14:39:19 2014 -0700 +++ b/contrib/revsetbenchmarks.py Tue Apr 29 13:18:22 2014 -0700 @@ -14,6 +14,7 @@ # to compare performance. import sys +import os from subprocess import check_call, Popen, CalledProcessError, STDOUT, PIPE # cannot use argparse, python 2.7 only from optparse import OptionParser @@ -42,7 +43,8 @@ try: output = check_output(['./hg', '--config', - 'extensions.perf=contrib/perf.py', + 'extensions.perf=' + + os.path.join(contribdir, 'perf.py'), 'perfrevset', revset], stderr=STDOUT) @@ -79,6 +81,8 @@ parser.print_help() sys.exit(255) +# the directory where both this script and the perf.py extension live. +contribdir = os.path.dirname(__file__) target_rev = args[0]