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

Boris Feld boris.feld at octobus.net
Fri Nov 23 09:09:06 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at 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.

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'),


More information about the Mercurial-devel mailing list