Handle binary files in diffstat

Added/removed counts are "-".

Change-Id: I339a91019f700106bae92b200aa554876065ea62
This commit is contained in:
James E. Blair 2014-04-30 14:14:04 -07:00
parent 0a0ae71ea4
commit 989bccaa22
1 changed files with 10 additions and 2 deletions

View File

@ -173,8 +173,16 @@ class RevisionRow(urwid.WidgetWrap):
total_added = 0
total_removed = 0
for added, removed, filename in stats:
total_added += int(added)
total_removed += int(removed)
try:
added = int(added)
except ValueError:
added = 0
try:
removed = int(removed)
except ValueError:
removed = 0
total_added += added
total_removed += removed
rows.append(urwid.Columns([urwid.Text(filename),
(10, urwid.Text('+%s, -%s' % (added, removed))),
]))