[PATCH 5 of 7] contrib/perf: perfparents handle tiny repos

timeless timeless at mozdev.org
Tue Nov 24 16:36:28 CST 2015


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1448398454 0
#      Tue Nov 24 20:54:14 2015 +0000
# Node ID 3cf447f1d3a7d77969331a93c8cd003b1dbcbaf7
# Parent  8fe942905e529e04e6d0e19e5b62ee6458eb1266
contrib/perf: perfparents handle tiny repos

refuse to run if there are not enough commits

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2,7 +2,7 @@
 '''helper extension to measure performance'''
 
 from mercurial import cmdutil, scmutil, util, commands, obsolete
-from mercurial import repoview, branchmap, merge, copies
+from mercurial import repoview, branchmap, merge, copies, error
 import time, os, sys
 import functools
 
@@ -300,6 +300,8 @@
 @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")
     nl = [repo.changelog.node(i) for i in xrange(1000)]
     def d():
         for n in nl:


More information about the Mercurial-devel mailing list