Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 14437:cbe13e6bdc34
patch: restore the previous output of 'diff --stat'
Restore the previous diffstat behaviour of scaling by the maximum number of
changes to a single file. Changeset f03f08240c32 modified the diffstat to be
scaled by the total number of changes. This seems to have been unintentional.
author | Steven Brown <StevenGBrown@gmail.com> |
---|---|
date | Thu, 26 May 2011 22:51:02 +0800 |
parents | 5f6090e559fa |
children | c78d41db6f88 |
line wrap: on
line diff
--- a/mercurial/patch.py Tue May 24 17:48:16 2011 +0200 +++ b/mercurial/patch.py Thu May 26 22:51:02 2011 +0800 @@ -1672,14 +1672,15 @@ yield text def diffstatsum(stats): - maxfile, addtotal, removetotal, binary = 0, 0, 0, False + maxfile, maxtotal, addtotal, removetotal, binary = 0, 0, 0, 0, False for f, a, r, b in stats: maxfile = max(maxfile, encoding.colwidth(f)) + maxtotal = max(maxtotal, a + r) addtotal += a removetotal += r binary = binary or b - return maxfile, addtotal, removetotal, binary + return maxfile, maxtotal, addtotal, removetotal, binary def diffstatdata(lines): diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$') @@ -1712,8 +1713,7 @@ def diffstat(lines, width=80, git=False): output = [] stats = diffstatdata(lines) - maxname, totaladds, totalremoves, hasbinary = diffstatsum(stats) - maxtotal = totaladds + totalremoves + maxname, maxtotal, totaladds, totalremoves, hasbinary = diffstatsum(stats) countwidth = len(str(maxtotal)) if hasbinary and countwidth < 3: