contrib/perf.py
changeset 27305 5831cfbf0e33
parent 27304 a6fd79495770
child 27306 bafb1235f505
--- 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)