From 9df3f8e6f29f4e121756cecc16e6df0c539bfead Mon Sep 17 00:00:00 2001 From: Heikki Hokkanen Date: Thu, 13 Sep 2007 19:40:49 +0300 Subject: [PATCH] Added try/except to catch weird lines from git-log --shortstat. This is a workaround for linux-2.6 repository. --- gitstats | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gitstats b/gitstats index d8e5db7..a2fc26f 100755 --- a/gitstats +++ b/gitstats @@ -277,8 +277,11 @@ class GitDataCollector(DataCollector): if line.find('files changed,') == -1: pos = line.find(' ') if pos != -1: - (stamp, author) = (int(line[:pos]), line[pos+1:]) - self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted, 'lines': total_lines } + try: + (stamp, author) = (int(line[:pos]), line[pos+1:]) + self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted, 'lines': total_lines } + except ValueError: + print 'Warning: unexpected line "%s"' % line else: print 'Warning: unexpected line "%s"' % line else: -- 2.11.4.GIT