contrib/perf: perfparents handle tiny repos
refuse to run if there are not enough commits
--- 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: