# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2020-08-10 10:17:21 # Node ID 05d19ca33b33820c1c36d756200d6e036e56449c # Parent 72e503a24715f0a29f2a183c826d61abc90fb6f1 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 diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1367,8 +1367,7 @@ def applyupdates( 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 = [] diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py --- a/mercurial/mergestate.py +++ b/mercurial/mergestate.py @@ -592,8 +592,10 @@ class mergestate(object): 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):