Show More
@@ -1787,18 +1787,17 b' def diffstatdata(lines):' | |||
|
1787 | 1787 | diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$') |
|
1788 | 1788 | |
|
1789 | 1789 | results = [] |
|
1790 | filename, adds, removes = None, 0, 0 | |
|
1790 | filename, adds, removes, isbinary = None, 0, 0, False | |
|
1791 | 1791 | |
|
1792 | 1792 | def addresult(): |
|
1793 | 1793 | if filename: |
|
1794 | isbinary = adds == 0 and removes == 0 | |
|
1795 | 1794 | results.append((filename, adds, removes, isbinary)) |
|
1796 | 1795 | |
|
1797 | 1796 | for line in lines: |
|
1798 | 1797 | if line.startswith('diff'): |
|
1799 | 1798 | addresult() |
|
1800 | 1799 | # set numbers to 0 anyway when starting new file |
|
1801 | adds, removes = 0, 0 | |
|
1800 | adds, removes, isbinary = 0, 0, False | |
|
1802 | 1801 | if line.startswith('diff --git'): |
|
1803 | 1802 | filename = gitre.search(line).group(1) |
|
1804 | 1803 | elif line.startswith('diff -r'): |
@@ -1808,6 +1807,9 b' def diffstatdata(lines):' | |||
|
1808 | 1807 | adds += 1 |
|
1809 | 1808 | elif line.startswith('-') and not line.startswith('---'): |
|
1810 | 1809 | removes += 1 |
|
1810 | elif (line.startswith('GIT binary patch') or | |
|
1811 | line.startswith('Binary file')): | |
|
1812 | isbinary = True | |
|
1811 | 1813 | addresult() |
|
1812 | 1814 | return results |
|
1813 | 1815 | |
@@ -1832,7 +1834,7 b' def diffstat(lines, width=80, git=False)' | |||
|
1832 | 1834 | return max(i * graphwidth // maxtotal, int(bool(i))) |
|
1833 | 1835 | |
|
1834 | 1836 | for filename, adds, removes, isbinary in stats: |
|
1835 |
if |
|
|
1837 | if isbinary: | |
|
1836 | 1838 | count = 'Bin' |
|
1837 | 1839 | else: |
|
1838 | 1840 | count = adds + removes |
@@ -36,19 +36,21 b' Narrow diffstat:' | |||
|
36 | 36 | $ hg ci -m appenda |
|
37 | 37 | |
|
38 | 38 | $ printf '\0' > c |
|
39 |
$ h |
|
|
39 | $ touch d | |
|
40 | $ hg add c d | |
|
40 | 41 | |
|
41 | 42 | Binary diffstat: |
|
42 | 43 | |
|
43 | 44 | $ hg diff --stat |
|
44 |
c | |
|
|
45 | c | Bin | |
|
45 | 46 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
46 | 47 | |
|
47 | 48 | Binary git diffstat: |
|
48 | 49 | |
|
49 | 50 | $ hg diff --stat --git |
|
50 | 51 | c | Bin |
|
51 | 1 files changed, 0 insertions(+), 0 deletions(-) | |
|
52 | d | 0 | |
|
53 | 2 files changed, 0 insertions(+), 0 deletions(-) | |
|
52 | 54 | |
|
53 | 55 | $ hg ci -m createb |
|
54 | 56 | |
@@ -58,7 +60,7 b' Binary git diffstat:' | |||
|
58 | 60 | Filename with spaces diffstat: |
|
59 | 61 | |
|
60 | 62 | $ hg diff --stat |
|
61 |
file with spaces | |
|
|
63 | file with spaces | Bin | |
|
62 | 64 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
63 | 65 | |
|
64 | 66 | Filename with spaces git diffstat: |
General Comments 0
You need to be logged in to leave comments.
Login now