diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -270,7 +270,7 @@ def showdiffstat(context, mapping): 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) diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2001,6 +2001,8 @@ Diff here should be the same: @@ -0,0 +1,1 @@ +b + $ hg log -r 3 -T'{diffstat}\n' + 2: +2/-1 Test that diff.merge is respected (file b was added on one side and and therefore merged cleanly) @@ -2021,6 +2023,9 @@ and therefore merged cleanly) -b +c + $ hg log -r 3 -T'{diffstat}\n' --config diff.merge=yes + 1: +1/-1 + $ cd .. 'hg log -r rev fn' when last(filelog(fn)) != rev