##// END OF EJS Templates
diffstat: fix parsing of filenames with spaces...
Gastón Kleiman -
r13395:104c9ed9 default
parent child Browse files
Show More
@@ -1529,6 +1529,8 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1529 yield text
1529 yield text
1530
1530
1531 def diffstatdata(lines):
1531 def diffstatdata(lines):
1532 diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$')
1533
1532 filename, adds, removes = None, 0, 0
1534 filename, adds, removes = None, 0, 0
1533 for line in lines:
1535 for line in lines:
1534 if line.startswith('diff'):
1536 if line.startswith('diff'):
@@ -1539,9 +1541,9 b' def diffstatdata(lines):'
1539 adds, removes = 0, 0
1541 adds, removes = 0, 0
1540 if line.startswith('diff --git'):
1542 if line.startswith('diff --git'):
1541 filename = gitre.search(line).group(1)
1543 filename = gitre.search(line).group(1)
1542 else:
1544 elif line.startswith('diff -r'):
1543 # format: "diff -r ... -r ... filename"
1545 # format: "diff -r ... -r ... filename"
1544 filename = line.split(None, 5)[-1]
1546 filename = diffre.search(line).group(1)
1545 elif line.startswith('+') and not line.startswith('+++'):
1547 elif line.startswith('+') and not line.startswith('+++'):
1546 adds += 1
1548 adds += 1
1547 elif line.startswith('-') and not line.startswith('---'):
1549 elif line.startswith('-') and not line.startswith('---'):
@@ -46,3 +46,20 b' Binary git diffstat:'
46 b | Bin
46 b | Bin
47 1 files changed, 0 insertions(+), 0 deletions(-)
47 1 files changed, 0 insertions(+), 0 deletions(-)
48
48
49 $ hg ci -m createb
50
51 $ printf '\0' > "file with spaces"
52 $ hg add "file with spaces"
53
54 Filename with spaces diffstat:
55
56 $ hg diff --stat
57 file with spaces | 0
58 1 files changed, 0 insertions(+), 0 deletions(-)
59
60 Filename with spaces git diffstat:
61
62 $ hg diff --stat --git
63 file with spaces | Bin
64 1 files changed, 0 insertions(+), 0 deletions(-)
65
General Comments 0
You need to be logged in to leave comments. Login now