[PATCH 5 of 8] contrib/perf: add getlen

timeless timeless at mozdev.org
Tue Dec 8 01:07:26 CST 2015


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1449255932 0
#      Fri Dec 04 19:05:32 2015 +0000
# Node ID 8e92b61c81221b2dbfd351745e8c60e8ffca38f3
# Parent  80b1b6ccc3d7931ac3b4af2ad6d029a461e41bbe
contrib/perf: add getlen

get len will return 1 if perf.stub

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -11,6 +11,11 @@
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 
+def getlen(ui):
+    if ui.configbool("perf", "stub"):
+        return lambda x: 1
+    return len
+
 def gettimer(ui, opts=None):
     """return a timer function and formatter: (timer, formatter)
 


More information about the Mercurial-devel mailing list