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
--- 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()