templatekw: use diffstatsum in diffstat keyword
authorMatt Mackall <mpm@selenic.com>
Sat, 21 May 2011 15:09:15 -0500
changeset 14403 2c9f5897d4b7
parent 14402 f03f08240c32
child 14404 69b60edfd76c
templatekw: use diffstatsum in diffstat keyword
mercurial/templatekw.py
--- 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']