diff -r f2de8f31cb59 -r d1471dbbdd63 mercurial/merge.py --- 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()