diff mercurial/templatekw.py @ 51144:9ff3d5395d6b

templatekw: fix inconsistency of diffstat with diff.merge Previously, `-T'{diffstat}'` was giving stats from the diff against p1, regardless of whether `--config diff.merge=yes` is set. This was inconsistent with `log --patch` which is aware of that option.
author pacien <pacien.trangirard@pacien.net>
date Tue, 14 Nov 2023 22:47:17 +0100
parents e6df205a876c
children
line wrap: on
line diff
--- a/mercurial/templatekw.py	Wed Nov 15 02:39:53 2023 +0100
+++ b/mercurial/templatekw.py	Tue Nov 14 22:47:17 2023 +0100
@@ -270,7 +270,7 @@
     ui = context.resource(mapping, b'ui')
     ctx = context.resource(mapping, b'ctx')
     diffopts = diffutil.diffallopts(ui, {b'noprefix': False})
-    diff = ctx.diff(opts=diffopts)
+    diff = ctx.diff(diffutil.diff_parent(ctx), opts=diffopts)
     stats = patch.diffstatdata(util.iterlines(diff))
     maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
     return b'%d: +%d/-%d' % (len(stats), adds, removes)