mercurial/commands.py
changeset 47610 f89d3050dcd5
parent 47437 7a430116f639
child 47763 76dccbbe73fd
--- a/mercurial/commands.py	Thu Jul 08 22:08:32 2021 +0200
+++ b/mercurial/commands.py	Thu Jul 08 04:29:36 2021 +0200
@@ -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