filemerge: when merge tool uses $output, don't leave markers in $local stable
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 15 Mar 2022 13:31:39 -0700
branchstable
changeset 48967 a54a866349ed
parent 48966 b10a944c0486
child 48968 4a8eff64860a
filemerge: when merge tool uses $output, don't leave markers in $local As explained in the previous patch, we incorrectly leave conflict markers in both `$local` and `$output` since D12190. I don't understand why it broke but the fix is simple and clear after all the recent refactoring. Differential Revision: https://phab.mercurial-scm.org/D12379
mercurial/filemerge.py
tests/test-merge-tools.t
--- a/mercurial/filemerge.py	Tue Mar 15 13:40:45 2022 -0700
+++ b/mercurial/filemerge.py	Tue Mar 15 13:31:39 2022 -0700
@@ -755,8 +755,7 @@
         # Remove the .orig to make syntax-highlighting more likely.
         if localoutputpath.endswith(b'.orig'):
             localoutputpath, ext = os.path.splitext(localoutputpath)
-        localdata = util.readfile(localpath)
-        files.append((b"local", localoutputpath, localdata))
+        files.append((b"local", localoutputpath, backup.data()))
 
     with _maketempfiles(files) as temppaths:
         basepath, otherpath = temppaths[:2]
--- a/tests/test-merge-tools.t	Tue Mar 15 13:40:45 2022 -0700
+++ b/tests/test-merge-tools.t	Tue Mar 15 13:31:39 2022 -0700
@@ -1225,12 +1225,8 @@
   merging f
   revision 0
   space
-  <<<<<<< working copy: ef83787e2614 - test: revision 1 (known-bad-output !)
   revision 1
   space
-  ======= (known-bad-output !)
-  revision 4 (known-bad-output !)
-  >>>>>>> merge rev:    81448d39c9a0 - test: revision 4 (known-bad-output !)
   revision 4
   <<<<<<< working copy: ef83787e2614 - test: revision 1
   revision 1