contrib/perf: perfparents handle tiny repos
authortimeless <timeless@mozdev.org>
Tue, 24 Nov 2015 20:54:14 +0000
changeset 27099 e94bfebb4f35
parent 27098 64cb281d23a5
child 27100 8d5dba93aa4f
contrib/perf: perfparents handle tiny repos refuse to run if there are not enough commits
contrib/perf.py
--- 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: