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