[Updated] D11074: resolve: use the `parentchange` context manager to apply merge action

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Jul 15 16:57:15 UTC 2021


Closed by commit rHGf89d3050dcd5: resolve: use the `parentchange` context manager to apply merge action (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11074?vs=29266&id=29288

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11074/new/

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6238,7 +6238,20 @@
 
         ms.commit()
         branchmerge = repo.dirstate.p2() != repo.nullid
-        mergestatemod.recordupdates(repo, ms.actions(), branchmerge, None)
+        # resolve is not doing a parent change here, however, `record updates`
+        # will call some dirstate API that at intended for parent changes call.
+        # Ideally we would not need this and could implement a lighter version
+        # of the recordupdateslogic that will not have to deal with the part
+        # related to parent changes. However this would requires that:
+        # - we are sure we passed around enough information at update/merge
+        #   time to no longer needs it at `hg resolve time`
+        # - we are sure we store that information well enough to be able to reuse it
+        # - we are the necessary logic to reuse it right.
+        #
+        # All this should eventually happens, but in the mean time, we use this
+        # context manager slightly out of the context it should be.
+        with repo.dirstate.parentchange():
+            mergestatemod.recordupdates(repo, ms.actions(), branchmerge, None)
 
         if not didwork and pats:
             hint = None



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210715/f205bb8f/attachment-0002.html>


More information about the Mercurial-patches mailing list