diff mercurial/repair.py @ 33042:dbc2ee17053e

bundle: transpose transaction scope with bundle type switch This moves the transaction with-statements outside of the per-bundle-version switches, so the next patch will be a little simpler.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Jun 2017 21:27:57 -0700
parents b82615afde65
children 18c2489ac96d
line wrap: on
line diff
--- a/mercurial/repair.py	Thu Jun 22 15:03:13 2017 -0700
+++ b/mercurial/repair.py	Thu Jun 22 21:27:57 2017 -0700
@@ -207,13 +207,14 @@
                 # silence internal shuffling chatter
                 repo.ui.pushbuffer()
             tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile)
-            if isinstance(gen, bundle2.unbundle20):
-                with repo.transaction('strip') as tr:
+            txnname = 'strip'
+            if not isinstance(gen, bundle2.unbundle20):
+                txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
+            with repo.transaction(txnname) as tr:
+                if isinstance(gen, bundle2.unbundle20):
                     bundle2.applybundle(repo, gen, tr, source='strip',
                                         url=tmpbundleurl)
-            else:
-                txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
-                with repo.transaction(txnname) as tr:
+                else:
                     bundle2.applybundle1(repo, gen, tr, 'strip', tmpbundleurl,
                                          emptyok=True)
             if not repo.ui.verbose: