changeset 45405:05d19ca33b33

mergestate: replace `addmergedother()` with generic `addcommitinfo()` (API) Storing that a file is resolved for the other parent while merging is just one case of things we will like to store in the mergestate. There are more which we will like to store. This patch replaces `addmergedother()` with a much more generic `addcommitinfo()`. Doing this, we also blinding stores the same key value pair generated by the merge code instead of touching them. Differential Revision: https://phab.mercurial-scm.org/D8923
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 10 Aug 2020 15:47:21 +0530
parents 72e503a24715
children 034d94f8761b
files mercurial/merge.py mercurial/mergestate.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Mon Aug 10 15:38:45 2020 +0530
+++ b/mercurial/merge.py	Mon Aug 10 15:47:21 2020 +0530
@@ -1367,8 +1367,7 @@
     for f, op in pycompat.iteritems(mresult.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'filenode-source'] == b'other':
-            ms.addmergedother(f)
+        ms.addcommitinfo(f, op)
 
     moves = []
 
--- a/mercurial/mergestate.py	Mon Aug 10 15:38:45 2020 +0530
+++ b/mercurial/mergestate.py	Mon Aug 10 15:47:21 2020 +0530
@@ -592,8 +592,10 @@
         self._state[path] = [MERGE_RECORD_UNRESOLVED_PATH, frename, forigin]
         self._dirty = True
 
-    def addmergedother(self, path):
-        self._stateextras[path] = {b'filenode-source': b'other'}
+    def addcommitinfo(self, path, data):
+        """ stores information which is required at commit
+        into _stateextras """
+        self._stateextras[path].update(data)
         self._dirty = True
 
     def __contains__(self, dfile):