changeset 44999:d1471dbbdd63

merge: don't grab wlock when merging in memory I noticed this because we have an internal extension that does an in-memory rebase while holding only a repo lock, which resulted in a developer warning about the working copy lock being taken after the repo lock. Differential Revision: https://phab.mercurial-scm.org/D8665
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 24 Jun 2020 23:17:56 -0700
parents f2de8f31cb59
children 3fadbdc47aed
files mercurial/merge.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Jun 24 14:44:21 2020 +0200
+++ b/mercurial/merge.py	Wed Jun 24 23:17:56 2020 -0700
@@ -1572,7 +1572,11 @@
                     ),
                 )
             )
-    with repo.wlock():
+    if wc is not None and wc.isinmemory():
+        maybe_wlock = util.nullcontextmanager()
+    else:
+        maybe_wlock = repo.wlock()
+    with maybe_wlock:
         if wc is None:
             wc = repo[None]
         pl = wc.parents()