Mercurial > hg-stable
changeset 14403:2c9f5897d4b7
templatekw: use diffstatsum in diffstat keyword
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 21 May 2011 15:09:15 -0500 |
parents | f03f08240c32 |
children | 69b60edfd76c |
files | mercurial/templatekw.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatekw.py Sat May 21 15:06:38 2011 -0500 +++ b/mercurial/templatekw.py Sat May 21 15:09:15 2011 -0500 @@ -185,12 +185,9 @@ """:diffstat: String. Statistics of changes with the following format: "modified files: +added/-removed lines" """ - files, adds, removes = 0, 0, 0 - for i in patch.diffstatdata(util.iterlines(ctx.diff())): - files += 1 - adds += i[1] - removes += i[2] - return '%s: +%s/-%s' % (files, adds, removes) + stats = patch.diffstatdata(util.iterlines(ctx.diff())) + maxname, adds, removes, binary = patch.diffstatsum(stats) + return '%s: +%s/-%s' % (len(stats), adds, removes) def showextras(**args): templ = args['templ']