Mercurial > public > mercurial-scm > hg
diff mercurial/patch.py @ 7664:3cc74ee75b0d
diffstat: don't fail on merges
First version by Alexander Solovyov <piranha@piranha.org.ua>
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 13 Jan 2009 20:28:06 +0200 |
parents | ab39d1813e51 |
children | e5f445c94226 |
line wrap: on
line diff
--- a/mercurial/patch.py Sat Jan 17 15:25:20 2009 +0100 +++ b/mercurial/patch.py Tue Jan 13 20:28:06 2009 +0200 @@ -1343,14 +1343,13 @@ single(rev, seqno+1, fp) def diffstatdata(lines): - filename = None + filename, adds, removes = None, 0, 0 for line in lines: if line.startswith('diff'): if filename: yield (filename, adds, removes) # set numbers to 0 anyway when starting new file - adds = 0 - removes = 0 + adds, removes = 0, 0 if line.startswith('diff --git'): filename = gitre.search(line).group(1) else: @@ -1360,7 +1359,8 @@ adds += 1 elif line.startswith('-') and not line.startswith('---'): removes += 1 - yield (filename, adds, removes) + if filename: + yield (filename, adds, removes) def diffstat(lines): output = []