Patchwork [3,of,8] contrib/perf: perfparents honor config perf.parentscount

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 8, 2015, 7:07 a.m.
Message ID <0aa3baaf6e82413f8de7.1449558444@waste.org>
Download mbox | patch
Permalink /patch/11926/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 8, 2015, 7:07 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1449253087 0
#      Fri Dec 04 18:18:07 2015 +0000
# Node ID 0aa3baaf6e82413f8de71625adab1fb1e8460475
# Parent  0efb6e25627f511eb00f7be5745332d2ccf2ac58
contrib/perf: perfparents honor config perf.parentscount

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -307,10 +307,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)