changeset 27099:e94bfebb4f35

contrib/perf: perfparents handle tiny repos refuse to run if there are not enough commits
author timeless <timeless@mozdev.org>
date Tue, 24 Nov 2015 20:54:14 +0000
parents 64cb281d23a5
children 8d5dba93aa4f
files contrib/perf.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue Nov 24 21:44:16 2015 +0000
+++ b/contrib/perf.py	Tue Nov 24 20:54:14 2015 +0000
@@ -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: