# HG changeset patch # User Martin von Zweigbergk # Date 2022-02-10 19:00:32 # Node ID 59c6724ddccb6cb1df2a6bc5c17d18fc76a7a2c3 # Parent aed8ef33db8b6f97cc72bcb3d1c903549993115b simplemerge: store input data in MergeInput I want to be able to update the file contents for support for partial conflict resolution. Having the text available (and later settable) on `MergeInput` will enable that. Differential Revision: https://phab.mercurial-scm.org/D12144 diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -481,6 +481,19 @@ class MergeInput(object): # separated by a ':'. The label is padded to make the ':' aligned among # all merge inputs. self.label_detail = label_detail + self._text = None + + def text(self): + if self._text is None: + # Merges were always run in the working copy before, which means + # they used decoded data, if the user defined any repository + # filters. + # + # Maintain that behavior today for BC, though perhaps in the future + # it'd be worth considering whether merging encoded data (what the + # repository usually sees) might be more useful. + self._text = self.fctx.decodeddata() + return self._text def simplemerge( @@ -498,26 +511,19 @@ def simplemerge( The merged result is written into `localctx`. """ - def readctx(ctx): - # Merges were always run in the working copy before, which means - # they used decoded data, if the user defined any repository - # filters. - # - # Maintain that behavior today for BC, though perhaps in the future - # it'd be worth considering whether merging encoded data (what the - # repository usually sees) might be more useful. + def readctx(input): return _verifytext( - ctx.decodeddata(), - ctx.path(), + input.text(), + input.fctx.path(), ui, quiet=quiet, allow_binary=allow_binary, ) try: - localtext = readctx(local.fctx) - basetext = readctx(base.fctx) - othertext = readctx(other.fctx) + localtext = readctx(local) + basetext = readctx(base) + othertext = readctx(other) except error.Abort: return True