Patchwork [5,of,8,V2] perf: pre-indent some code in `perfbranchmapupdate`

login
register
mail settings
Submitter Boris Feld
Date Nov. 26, 2018, 6:44 p.m.
Message ID <3a9ca368b2362f230489.1543257876@localhost.localdomain>
Download mbox | patch
Permalink /patch/36796/
State Accepted
Headers show

Comments

Boris Feld - Nov. 26, 2018, 6:44 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1542837366 -3600
#      Wed Nov 21 22:56:06 2018 +0100
# Node ID 3a9ca368b2362f2304895a9a238abccdd4aee633
# Parent  dc3191e230daa615929d41cc410bfb16cfe658d9
# EXP-Topic perf-branchmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 3a9ca368b236
perf: pre-indent some code in `perfbranchmapupdate`

This make the next patch easier to read.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2274,17 +2274,18 @@  def perfbranchmapupdate(ui, repo, base=(
     msg = 'benchmark of branchmap with %d revisions with %d new ones\n'
     ui.status(msg % (len(allbaserevs), len(newrevs)))
 
-    base = branchmap.branchcache()
-    base.update(repo, allbaserevs)
-
-    def setup():
-        x[0] = base.copy()
+    if True:
+        base = branchmap.branchcache()
+        base.update(repo, allbaserevs)
 
-    def bench():
-        x[0].update(repo, newrevs)
+        def setup():
+            x[0] = base.copy()
 
-    timer(bench, setup=setup)
-    fm.end()
+        def bench():
+            x[0].update(repo, newrevs)
+
+        timer(bench, setup=setup)
+        fm.end()
 
 @command(b'perfbranchmapload', [
      (b'f', b'filter', b'', b'Specify repoview filter'),