# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497593354 25200
#      Thu Jun 15 23:09:14 2017 -0700
# Node ID d11e2343762b38cab60fa8d71da44eab764eea7a
# Parent  ac986751910396de9818cf981b35f131a5ab1634
repair: create transaction for bundle1 unbundling earlier

See earlier patch for motivation.

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -201,13 +201,15 @@
             if not repo.ui.verbose:
                 # silence internal shuffling chatter
                 repo.ui.pushbuffer()
+            tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile)
             if isinstance(gen, bundle2.unbundle20):
                 with repo.transaction('strip') as tr:
                     bundle2.applybundle(repo, gen, tr, source='strip',
-                                        url='bundle:' + vfs.join(tmpbundlefile))
+                                        url=tmpbundleurl)
             else:
-                gen.apply(repo, 'strip', 'bundle:' + vfs.join(tmpbundlefile),
-                          True)
+                txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
+                with repo.transaction(txnname):
+                    gen.apply(repo, 'strip', tmpbundleurl, True)
             if not repo.ui.verbose:
                 repo.ui.popbuffer()
             f.close()