changeset 32927:febd6bfa770d

exchange: create transaction for bundle1 unbundling earlier changegroup.apply() currently creates a transation if there isn't already one. Having the callers of that method pass in an existing transaction seems a little cleaner. To do that, we need to make sure all callers have a transaction. Since the transaction name is used as a hook argument (HG_TXNNAME), we need to match the name from changegroup.apply().
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 15 Jun 2017 16:10:53 -0700
parents 038bfc384271
children ac9867519103
files mercurial/exchange.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Mon Jun 19 00:06:23 2017 -0700
+++ b/mercurial/exchange.py	Thu Jun 15 16:10:53 2017 -0700
@@ -1734,7 +1734,8 @@
         # push can proceed
         if not isinstance(cg, bundle2.unbundle20):
             # legacy case: bundle1 (changegroup 01)
-            with repo.lock():
+            txnname = "\n".join([source, util.hidepassword(url)])
+            with repo.lock(), repo.transaction(txnname):
                 r = cg.apply(repo, source, url)
         else:
             r = None