[PATCH] exchange: use context manager for bundle1 unbundling

Martin von Zweigbergk martinvonz at google.com
Fri Jun 16 06:02:11 UTC 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1497592640 25200
#      Thu Jun 15 22:57:20 2017 -0700
# Node ID 31b11625ed4218a1ab33ffacd1b6d0fe11996f55
# Parent  2d327b17f319e8e3305c33734d0202978d57f0f9
exchange: use context manager for bundle1 unbundling

The lazy locking is not used for bundle1, so using a regular context
manager is clearer.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1733,8 +1733,8 @@
         # push can proceed
         if not util.safehasattr(cg, 'params'):
             # legacy case: bundle1 (changegroup 01)
-            lockandtr[1] = repo.lock()
-            r = cg.apply(repo, source, url)
+            with repo.lock():
+                r = cg.apply(repo, source, url)
         else:
             r = None
             try:


More information about the Mercurial-devel mailing list