Selaa lähdekoodia

Workaround for linux-2.6.

Heikki Hokkanen 18 vuotta sitten
vanhempi
commit
466c2aea01
1 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 8
    2
      statgit

+ 8
- 2
statgit Näytä tiedosto

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