diff -r cd1ca2556cac -r 7bb7be1c1385 mercurial/patch.py --- 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(.*)$')