changeset 27305:5831cfbf0e33

perf: perfparents honor config perf.parentscount
author timeless <timeless@mozdev.org>
date Fri, 04 Dec 2015 18:18:07 +0000
parents a6fd79495770
children bafb1235f505
files contrib/perf.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Fri Dec 04 17:41:30 2015 +0000
+++ b/contrib/perf.py	Fri Dec 04 18:18:07 2015 +0000
@@ -308,10 +308,13 @@
 @command('perfparents', formatteropts)
 def perfparents(ui, repo, **opts):
     timer, fm = gettimer(ui, opts)
-    if len(repo.changelog) < 1000:
-        raise error.Abort("repo needs 1000 commits for this test")
+    # control the number of commits perfparents iterates over
+    # experimental config: perf.parentscount
+    count = ui.configint("perf", "parentscount", 1000)
+    if len(repo.changelog) < count:
+        raise error.Abort("repo needs %d commits for this test" % count)
     repo = repo.unfiltered()
-    nl = [repo.changelog.node(i) for i in xrange(1000)]
+    nl = [repo.changelog.node(i) for i in xrange(count)]
     def d():
         for n in nl:
             repo.changelog.parents(n)