##// END OF EJS Templates
perf: add historical support of ui.load()...
Philippe Pepiot -
r30588:be0e7af8 default
parent child Browse files
Show More
@@ -5,6 +5,11 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 # "historical portability" policy of contrib/benchmarks:
9 #
10 # We have to make this code work correctly with current mercurial stable branch
11 # and if possible with reasonable cost with early Mercurial versions.
12
8 '''ASV (https://asv.readthedocs.io) benchmark suite
13 '''ASV (https://asv.readthedocs.io) benchmark suite
9
14
10 Benchmark are parameterized against reference repositories found in the
15 Benchmark are parameterized against reference repositories found in the
@@ -36,6 +41,7 b' from mercurial import ('
36 extensions,
41 extensions,
37 hg,
42 hg,
38 ui as uimod,
43 ui as uimod,
44 util,
39 )
45 )
40
46
41 basedir = os.path.abspath(os.path.join(os.path.dirname(__file__),
47 basedir = os.path.abspath(os.path.join(os.path.dirname(__file__),
@@ -50,7 +56,12 b" outputre = re.compile((r'! wall (\\d+.\\d+"
50
56
51 def runperfcommand(reponame, command, *args, **kwargs):
57 def runperfcommand(reponame, command, *args, **kwargs):
52 os.environ["HGRCPATH"] = os.environ.get("ASVHGRCPATH", "")
58 os.environ["HGRCPATH"] = os.environ.get("ASVHGRCPATH", "")
53 ui = uimod.ui.load()
59 # for "historical portability"
60 # ui.load() has been available since d83ca85
61 if util.safehasattr(uimod.ui, "load"):
62 ui = uimod.ui.load()
63 else:
64 ui = uimod.ui()
54 repo = hg.repository(ui, os.path.join(reposdir, reponame))
65 repo = hg.repository(ui, os.path.join(reposdir, reponame))
55 perfext = extensions.load(ui, 'perfext',
66 perfext = extensions.load(ui, 'perfext',
56 os.path.join(basedir, 'contrib', 'perf.py'))
67 os.path.join(basedir, 'contrib', 'perf.py'))
General Comments 0
You need to be logged in to leave comments. Login now