log: respect diff.merge in -p output
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 04 Feb 2021 13:32:11 -0800
changeset 46498 3caa3698335e
parent 46497 4a012e531066
child 46499 eace48b4a786
log: respect diff.merge in -p output Differential Revision: https://phab.mercurial-scm.org/D9958
mercurial/logcmdutil.py
relnotes/next
tests/test-log.t
--- a/mercurial/logcmdutil.py	Thu Feb 04 13:21:01 2021 -0800
+++ b/mercurial/logcmdutil.py	Thu Feb 04 13:32:11 2021 -0800
@@ -247,7 +247,7 @@
             ui,
             ctx.repo(),
             diffopts,
-            ctx.p1(),
+            diff_parent(ctx),
             ctx,
             match=self._makefilematcher(ctx),
             stat=stat,
--- a/relnotes/next	Thu Feb 04 13:21:01 2021 -0800
+++ b/relnotes/next	Thu Feb 04 13:32:11 2021 -0800
@@ -11,7 +11,8 @@
  * There's a new `diff.merge` config option to show the changes
     relative to an automerge for merge changesets. This makes it
     easier to detect and review manual changes performed in merge
-    changesets. It is only supported by `hg diff --change` so far.
+    changesets. It is supported by `hg diff --change`, `hg log -p`
+    `hg incoming -p`, and `hg outgoing -p` so far.
 
 
 == Bug Fixes ==
--- a/tests/test-log.t	Thu Feb 04 13:21:01 2021 -0800
+++ b/tests/test-log.t	Thu Feb 04 13:32:11 2021 -0800
@@ -1966,6 +1966,26 @@
   @@ -0,0 +1,1 @@
   +b
   
+
+Test that diff.merge is respected (file b was added on one side and
+and therefore merged cleanly)
+
+  $ hg log -pr 3 --config diff.merge=yes
+  changeset:   3:8e07aafe1edc
+  tag:         tip
+  parent:      2:b09be438c43a
+  parent:      1:925d80f479bb
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3
+  
+  diff -r 8e07aafe1edc a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -b
+  +c
+  
   $ cd ..
 
 'hg log -r rev fn' when last(filelog(fn)) != rev