Workaround for linux-2.6.

This commit is contained in:
Heikki Hokkanen
2007-08-04 20:15:49 +03:00
parent 4c488e1bfc
commit 466c2aea01

10
statgit
View File

@@ -85,9 +85,15 @@ class GitDataCollector(DataCollector):
# TODO also collect statistics for "last 30 days"/"last 12 months"
lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
for line in lines:
# linux-2.6 says "<unknown>" for one line O_o
parts = line.split(' ')
stamp = int(parts[0])
author = ' '.join(parts[1:])
author = ''
try:
stamp = int(parts[0])
except ValueError:
stamp = 0
if len(parts) > 1:
author = ' '.join(parts[1:])
date = datetime.datetime.fromtimestamp(float(stamp))
# First and last commit stamp