Show More
@@ -1684,12 +1684,17 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||
|
1684 | 1684 | def diffstatdata(lines): |
|
1685 | 1685 | diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$') |
|
1686 | 1686 | |
|
1687 | results = [] | |
|
1687 | 1688 | filename, adds, removes = None, 0, 0 |
|
1689 | ||
|
1690 | def addresult(): | |
|
1691 | if filename: | |
|
1692 | isbinary = adds == 0 and removes == 0 | |
|
1693 | results.append((filename, adds, removes, isbinary)) | |
|
1694 | ||
|
1688 | 1695 | for line in lines: |
|
1689 | 1696 | if line.startswith('diff'): |
|
1690 | if filename: | |
|
1691 | isbinary = adds == 0 and removes == 0 | |
|
1692 | yield (filename, adds, removes, isbinary) | |
|
1697 | addresult() | |
|
1693 | 1698 | # set numbers to 0 anyway when starting new file |
|
1694 | 1699 | adds, removes = 0, 0 |
|
1695 | 1700 | if line.startswith('diff --git'): |
@@ -1701,9 +1706,8 b' def diffstatdata(lines):' | |||
|
1701 | 1706 | adds += 1 |
|
1702 | 1707 | elif line.startswith('-') and not line.startswith('---'): |
|
1703 | 1708 | removes += 1 |
|
1704 | if filename: | |
|
1705 | isbinary = adds == 0 and removes == 0 | |
|
1706 | yield (filename, adds, removes, isbinary) | |
|
1709 | addresult() | |
|
1710 | return results | |
|
1707 | 1711 | |
|
1708 | 1712 | def diffstat(lines, width=80, git=False): |
|
1709 | 1713 | output = [] |
General Comments 0
You need to be logged in to leave comments.
Login now