diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -299,7 +299,7 @@ def showdiffstat(repo, ctx, templ, **arg """String. Statistics of changes with the following format: "modified files: +added/-removed lines" """ - stats = patch.diffstatdata(util.iterlines(ctx.diff())) + stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False))) maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats) return '%s: +%s/-%s' % (len(stats), adds, removes) diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -1517,6 +1517,13 @@ prepare a stack of patches depending on | o initial [Babar] 2: +8/-0 +Adding those config options should not change the output of diffstat. Bugfix #4755. + + $ hg log -r . --template '{diffstat}\n' + 1: +1/-0 + $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \ + > --config diff.noprefix=1 + 1: +1/-0 Importing with some success and some errors: