mercurial/patch.py
changeset 14401 7bb7be1c1385
parent 14400 cd1ca2556cac
child 14402 f03f08240c32
--- a/mercurial/patch.py	Sat May 21 15:01:28 2011 -0500
+++ b/mercurial/patch.py	Sat May 21 15:06:36 2011 -0500
@@ -1681,6 +1681,16 @@
             if text:
                 yield text
 
+def diffstatsum(stats):
+    maxfile, addtotal, removetotal, binary = 0, 0, 0, False
+    for f, a, r, b in stats:
+        maxfile = max(maxfile, encoding.colwidth(f))
+        addtotal += a
+        removetotal += r
+        binary = binary or b
+
+    return maxfile, addtotal, removetotal, binary
+
 def diffstatdata(lines):
     diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$')