Patchwork D9939: diff: suppress `merging foo` output lines when performing a merge diff

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2021, 5:02 p.m.
Message ID <differential-rev-PHID-DREV-sxq4ac7qrfw2tf75c4o5-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48250/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2021, 5:02 p.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-diff-change.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-diff-change.t b/tests/test-diff-change.t
--- a/tests/test-diff-change.t
+++ b/tests/test-diff-change.t
@@ -197,7 +197,6 @@ 
 merge diff should show only manual edits to a merge:
 
   $ hg diff --merge -c 6
-  merging file.txt
 (no diff output is expected here)
 
 Construct an "evil merge" that does something other than just the merge.
@@ -228,7 +227,6 @@ 
 up, making it easy to identify changes someone is otherwise trying to sneak
 into a merge.
   $ hg diff --merge -c 7
-  merging file.txt
   diff -r 8ad85e839ba7 file.txt
   --- a/file.txt	Thu Jan 01 00:00:00 1970 +0000
   +++ b/file.txt	Thu Jan 01 00:00:00 1970 +0000
@@ -277,7 +275,6 @@ 
   +this file is new in p2 of the merge
 With --merge, it's a diff against the conflicted content.
   $ hg diff --merge -c 11
-  merging file.txt
   diff -r 5010caab09f6 file.txt
   --- a/file.txt	Thu Jan 01 00:00:00 1970 +0000
   +++ b/file.txt	Thu Jan 01 00:00:00 1970 +0000
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2567,7 +2567,7 @@ 
             pctx1 = mctx.p1()
             pctx2 = mctx.p2()
             wctx = contextmod.overlayworkingctx(repo)
-            wctx.setbase(ctx1)
+            wctx.setbase(pctx1)
             with ui.configoverride(
                 {
                     (
@@ -2577,7 +2577,9 @@ 
                 },
                 b'diff --merge',
             ):
+                repo.ui.pushbuffer()
                 stats = mergemod.merge(pctx2, wc=wctx)
+                repo.ui.popbuffer()
             ctx1 = wctx
             ctx2 = mctx
         else: