Patchwork D12379: filemerge: when merge tool uses $output, don't leave markers in $local

login
register
mail settings
Submitter phabricator
Date March 15, 2022, 8:52 p.m.
Message ID <differential-rev-PHID-DREV-smfjyx35miiwqlzt63g2-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50723/
State New
Headers show

Comments

phabricator - March 15, 2022, 8:52 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As explained in the previous patch, we incorrectly leave conflict
  markers in both `$local` and `$output` since D12190 <https://phab.mercurial-scm.org/D12190>. I don't
  understand why it broke but the fix is simple and clear after all the
  recent refactoring.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/filemerge.py
  tests/test-merge-tools.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -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
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -754,8 +754,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]