exchange: fix locking to actually be scoped stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 11 Jun 2024 11:13:36 +0200
branchstable
changeset 51501 429d57227e7f
parent 51500 eb11153c1698
child 51502 3b69324d9535
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).
mercurial/exchange.py
--- 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()
         ):