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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Feb 15 12:56:11 UTC 2022


Closed by commit rHG59c6724ddccb: simplemerge: store input data in MergeInput (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

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

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/20220215/aa6eacb7/attachment-0002.html>


More information about the Mercurial-patches mailing list