[Request] [+ ] D8665: merge: don't grab wlock when merging in memory

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jun 25 14:20:35 UTC 2020


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8665

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -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()



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200625/fca9fa75/attachment.html>


More information about the Mercurial-patches mailing list