contrib: add perflog and perftemplating commands to perf extension
authorAlexander Solovyov <piranha@piranha.org.ua>
Mon, 23 Mar 2009 13:12:03 +0100
changeset 7872 f680a1bd679b
parent 7871 cdbe19abd1c5
child 7873 4a4c7f6a5912
contrib: add perflog and perftemplating commands to perf extension
contrib/perf.py
--- a/contrib/perf.py	Mon Mar 23 13:12:44 2009 +0100
+++ b/contrib/perf.py	Mon Mar 23 13:12:03 2009 +0100
@@ -1,7 +1,7 @@
 # perf.py - performance test routines
 
 from mercurial.i18n import _
-from mercurial import cmdutil, match
+from mercurial import cmdutil, match, commands
 import time, os, sys
 
 def timer(func):
@@ -101,6 +101,18 @@
 def perflookup(ui, repo, rev):
     timer(lambda: len(repo.lookup(rev)))
 
+def perflog(ui, repo):
+    ui.pushbuffer()
+    timer(lambda: commands.log(ui, repo, rev=[], date='', user=''))
+    ui.popbuffer()
+
+def perftemplating(ui, repo):
+    ui.pushbuffer()
+    timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
+                               template='{date|shortdate} [{rev}:{node|short}]'
+                               ' {author|person}: {desc|firstline}\n'))
+    ui.popbuffer()
+
 cmdtable = {
     'perflookup': (perflookup, []),
     'perfparents': (perfparents, []),
@@ -113,5 +125,7 @@
     'perftags': (perftags, []),
     'perfdirstate': (perfdirstate, []),
     'perfdirstatedirs': (perfdirstate, []),
+    'perflog': (perflog, []),
+    'perftemplating': (perftemplating, []),
 }