mercurial/merge.py
changeset 45276 cb6a72dc0511
parent 45275 8e8d513941b4
child 45277 c515c54f6530
--- a/mercurial/merge.py	Tue Jul 14 16:21:08 2020 +0530
+++ b/mercurial/merge.py	Tue Jul 14 16:31:52 2020 +0530
@@ -1241,12 +1241,21 @@
 
 
 def applyupdates(
-    repo, actions, wctx, mctx, overwrite, wantfiledata, labels=None
+    repo,
+    actions,
+    wctx,
+    mctx,
+    overwrite,
+    wantfiledata,
+    labels=None,
+    commitinfo=None,
 ):
     """apply the merge action list to the working directory
 
     wctx is the working copy context
     mctx is the context to be merged into the working copy
+    commitinfo is a mapping of information which needs to be stored somewhere
+               (probably mergestate) so that it can be used at commit time.
 
     Return a tuple of (counts, filedata), where counts is a tuple
     (updated, merged, removed, unresolved) that describes how many
@@ -1261,6 +1270,15 @@
         repo, wctx.p1().node(), mctx.node(), labels
     )
 
+    if commitinfo is None:
+        commitinfo = {}
+
+    for f, op in pycompat.iteritems(commitinfo):
+        # the other side of filenode was choosen while merging, store this in
+        # mergestate so that it can be reused on commit
+        if op == b'other':
+            ms.addmergedother(f)
+
     # add ACTION_GET_OTHER_AND_STORE to mergestate
     for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]:
         ms.addmergedother(e[0])
@@ -1935,7 +1953,14 @@
 
         wantfiledata = updatedirstate and not branchmerge
         stats, getfiledata = applyupdates(
-            repo, actions, wc, p2, overwrite, wantfiledata, labels=labels
+            repo,
+            actions,
+            wc,
+            p2,
+            overwrite,
+            wantfiledata,
+            labels=labels,
+            commitinfo=mresult.commitinfo,
         )
 
         if updatedirstate: