perf-unbundle: pre-indent the main block in per::unbundle stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 19 Oct 2022 01:54:04 +0200
branchstable
changeset 49553 220738a53d05
parent 49552 5f778b3a94ca
child 49554 27bff60887fe
perf-unbundle: pre-indent the main block in per::unbundle This makes the next changeset clearer.
contrib/perf.py
--- a/contrib/perf.py	Wed Oct 19 16:23:42 2022 -0400
+++ b/contrib/perf.py	Wed Oct 19 01:54:04 2022 +0200
@@ -2681,44 +2681,46 @@
 
     opts = _byteskwargs(opts)
 
-    with repo.lock():
-        bundle = [None, None]
-        orig_quiet = repo.ui.quiet
-        try:
-            repo.ui.quiet = True
-            with open(fname, mode="rb") as f:
-
-                def noop_report(*args, **kwargs):
-                    pass
-
-                def setup():
-                    gen, tr = bundle
-                    if tr is not None:
-                        tr.abort()
-                    bundle[:] = [None, None]
-                    f.seek(0)
-                    bundle[0] = exchange.readbundle(ui, f, fname)
-                    bundle[1] = repo.transaction(b'perf::unbundle')
-                    bundle[1]._report = noop_report  # silence the transaction
-
-                def apply():
-                    gen, tr = bundle
-                    bundle2.applybundle(
-                        repo,
-                        gen,
-                        tr,
-                        source=b'perf::unbundle',
-                        url=fname,
-                    )
-
-                timer, fm = gettimer(ui, opts)
-                timer(apply, setup=setup)
-                fm.end()
-        finally:
-            repo.ui.quiet == orig_quiet
-            gen, tr = bundle
-            if tr is not None:
-                tr.abort()
+    if True:
+        with repo.lock():
+            bundle = [None, None]
+            orig_quiet = repo.ui.quiet
+            try:
+                repo.ui.quiet = True
+                with open(fname, mode="rb") as f:
+
+                    def noop_report(*args, **kwargs):
+                        pass
+
+                    def setup():
+                        gen, tr = bundle
+                        if tr is not None:
+                            tr.abort()
+                        bundle[:] = [None, None]
+                        f.seek(0)
+                        bundle[0] = exchange.readbundle(ui, f, fname)
+                        bundle[1] = repo.transaction(b'perf::unbundle')
+                        # silence the transaction
+                        bundle[1]._report = noop_report
+
+                    def apply():
+                        gen, tr = bundle
+                        bundle2.applybundle(
+                            repo,
+                            gen,
+                            tr,
+                            source=b'perf::unbundle',
+                            url=fname,
+                        )
+
+                    timer, fm = gettimer(ui, opts)
+                    timer(apply, setup=setup)
+                    fm.end()
+            finally:
+                repo.ui.quiet == orig_quiet
+                gen, tr = bundle
+                if tr is not None:
+                    tr.abort()
 
 
 @command(