changeset 51633:429d57227e7f stable

exchange: fix locking to actually be scoped The previous code was taking locks before entering with statements, so exception before the with statement would not release the lock (except for garbage collection).
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 11 Jun 2024 11:13:36 +0200
parents eb11153c1698
children 3b69324d9535
files mercurial/exchange.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Mon Jun 10 10:59:44 2024 +0200
+++ b/mercurial/exchange.py	Tue Jun 11 11:13:36 2024 +0200
@@ -1694,10 +1694,10 @@
             )
 
     pullop.trmanager = transactionmanager(repo, b'pull', remote.url())
-    wlock = util.nullcontextmanager()
+    wlock = util.nullcontextmanager
     if not bookmod.bookmarksinstore(repo):
-        wlock = repo.wlock()
-    with wlock, repo.lock(), pullop.trmanager:
+        wlock = repo.wlock
+    with wlock(), repo.lock(), pullop.trmanager:
         if confirm or (
             repo.ui.configbool(b"pull", b"confirm") and not repo.ui.plain()
         ):