[Updated] D12144: simplemerge: store input data in MergeInput

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Feb 11 02:55:33 UTC 2022


martinvonz edited the summary of this revision.
martinvonz retitled this revision from "simplemerge: store file contents in MergeInput type" to "simplemerge: store input data in MergeInput".
martinvonz updated this revision to Diff 32134.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12144?vs=32093&id=32134

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12144/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D12144

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -481,6 +481,19 @@
         # 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 @@
     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
 



To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220211/9702f964/attachment-0002.html>


More information about the Mercurial-patches mailing list