Patchwork [2,of,6] perftemplating: move template formating into its own function

login
register
mail settings
Submitter Boris Feld
Date June 11, 2018, 7:52 a.m.
Message ID <1f377f7bfc6c960d8f45.1528703541@localhost.localdomain>
Download mbox | patch
Permalink /patch/32054/
State Accepted
Headers show

Comments

Boris Feld - June 11, 2018, 7:52 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1527780706 -7200
#      Thu May 31 17:31:46 2018 +0200
# Node ID 1f377f7bfc6c960d8f45bc0c85f22f15e89514e6
# Parent  2427db1c14de941e957690f17a0bb040e21dd063
# EXP-Topic perftemplate
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1f377f7bfc6c
perftemplating: move template formating into its own function

The lambda is not practical when time will come to alter the benchmark code.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -899,11 +899,14 @@  def perfmoonwalk(ui, repo, **opts):
 
 @command('perftemplating', formatteropts)
 def perftemplating(ui, repo, *revs, **opts):
+    def format():
+        commands.log(ui, repo, rev=revs, date='', user='',
+                     template='{date|shortdate} [{rev}:{node|short}]'
+                              ' {author|person}: {desc|firstline}\n')
+
     timer, fm = gettimer(ui, opts)
     ui.pushbuffer()
-    timer(lambda: commands.log(ui, repo, rev=revs, date='', user='',
-                               template='{date|shortdate} [{rev}:{node|short}]'
-                               ' {author|person}: {desc|firstline}\n'))
+    timer(format)
     ui.popbuffer()
     fm.end()