Patchwork [10,of,13] perf: pre-indent some code in `perfbranchmapupdate`

login
register
mail settings
Submitter Boris Feld
Date Nov. 23, 2018, 2:09 p.m.
Message ID <7db38417670e442bb34e.1542982146@localhost.localdomain>
Download mbox | patch
Permalink /patch/36739/
State Accepted
Headers show

Comments

Boris Feld - Nov. 23, 2018, 2:09 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 7db38417670e442bb34e0a047cfd6bed795a98f3
# Parent  d9447d83339527ab8225b13e7a518fe4118ba947
# EXP-Topic perf-branchmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 7db38417670e
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
@@ -2226,17 +2226,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'),