|
|
@@ -94,6 +94,7 @@ class GitDataCollector(DataCollector):
|
|
94
|
94
|
|
|
95
|
95
|
# TODO author of the month
|
|
96
|
96
|
self.author_of_month = {} # month -> author -> commits
|
|
|
97
|
+ self.author_of_year = {} # year -> author -> commits
|
|
97
|
98
|
self.commits_by_month = {} # month -> commits
|
|
98
|
99
|
|
|
99
|
100
|
lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
|
|
|
@@ -103,7 +104,7 @@ class GitDataCollector(DataCollector):
|
|
103
|
104
|
author = ' '.join(parts[1:])
|
|
104
|
105
|
|
|
105
|
106
|
yymm = datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m')
|
|
106
|
|
- if yymm in self.author_of_month and author in self.author_of_month[yymm]:
|
|
|
107
|
+ if yymm in self.author_of_month:
|
|
107
|
108
|
if author in self.author_of_month[yymm]:
|
|
108
|
109
|
self.author_of_month[yymm][author] += 1
|
|
109
|
110
|
else:
|
|
|
@@ -116,6 +117,16 @@ class GitDataCollector(DataCollector):
|
|
116
|
117
|
else:
|
|
117
|
118
|
self.commits_by_month[yymm] = 1
|
|
118
|
119
|
|
|
|
120
|
+ yy = datetime.datetime.fromtimestamp(stamp).year
|
|
|
121
|
+ if yy in self.author_of_year:
|
|
|
122
|
+ if author in self.author_of_year[yy]:
|
|
|
123
|
+ self.author_of_year[yy][author] += 1
|
|
|
124
|
+ else:
|
|
|
125
|
+ self.author_of_year[yy][author] = 1
|
|
|
126
|
+ else:
|
|
|
127
|
+ self.author_of_year[yy] = {}
|
|
|
128
|
+ self.author_of_year[yy][author] = 1
|
|
|
129
|
+
|
|
119
|
130
|
print self.author_of_month
|
|
120
|
131
|
|
|
121
|
132
|
def getActivityByDayOfWeek(self):
|
|
|
@@ -284,7 +295,14 @@ class HTMLReportCreator(ReportCreator):
|
|
284
|
295
|
f.write('</table>')
|
|
285
|
296
|
|
|
286
|
297
|
f.write('\n<h2>Author of Year</h2>\n\n')
|
|
287
|
|
- # TODO
|
|
|
298
|
+ f.write('<table><tr><th>Year</th><th>Author</th><th>Commits (%)</th></tr>')
|
|
|
299
|
+ for yy in reversed(sorted(data.author_of_year.keys())):
|
|
|
300
|
+ authordict = data.author_of_year[yy]
|
|
|
301
|
+ authors = getkeyssortedbyvalues(authordict)
|
|
|
302
|
+ authors.reverse()
|
|
|
303
|
+ commits = data.author_of_year[yy][authors[0]]
|
|
|
304
|
+ f.write('<tr><td>%s</td><td>%s</td><td>%d</td></tr>' % (yy, authors[0], commits))
|
|
|
305
|
+ f.write('</table>')
|
|
288
|
306
|
|
|
289
|
307
|
f.write('</body></html>')
|
|
290
|
308
|
f.close()
|