Author of Year: Commits (%). Sort tags date/desc & list general info.

This commit is contained in:
Heikki Hokkanen 2007-08-05 15:45:01 +03:00
parent 2dd78ed2cf
commit b825e4323f

16
statgit
View File

@ -79,6 +79,7 @@ class GitDataCollector(DataCollector):
self.author_of_month = {} # month -> author -> commits
self.author_of_year = {} # year -> author -> commits
self.commits_by_month = {} # month -> commits
self.commits_by_year = {} # year -> commits
self.first_commit_stamp = 0
self.last_commit_stamp = 0
@ -169,6 +170,10 @@ class GitDataCollector(DataCollector):
else:
self.author_of_year[yy] = {}
self.author_of_year[yy][author] = 1
if yy in self.commits_by_year:
self.commits_by_year[yy] += 1
else:
self.commits_by_year[yy] = 1
def getActivityByDayOfWeek(self):
return self.activity_by_day_of_week
@ -343,7 +348,7 @@ class HTMLReportCreator(ReportCreator):
authors = getkeyssortedbyvalues(authordict)
authors.reverse()
commits = data.author_of_year[yy][authors[0]]
f.write('<tr><td>%s</td><td>%s</td><td>%d</td></tr>' % (yy, authors[0], commits))
f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td></tr>' % (yy, authors[0], commits, (100 * commits) / data.commits_by_year[yy], data.commits_by_year[yy]))
f.write('</table>')
f.write('</body></html>')
@ -356,9 +361,16 @@ class HTMLReportCreator(ReportCreator):
f.write('<h1>Tags</h1>')
self.printNav(f)
f.write('<dl>')
f.write('<dt>Total tags</dt><dd>%d</dd>' % len(data.tags))
f.write('<dt>Average commits per tag</dt><dd>%.2f</dd>' % (data.getTotalCommits() / len(data.tags)))
f.write('</dl>')
f.write('<table>')
f.write('<tr><th>Name</th><th>Date</th></tr>')
for tag in data.tags.keys():
# sort the tags by date desc
tags_sorted_by_date_desc = map(lambda el : el[1], reversed(sorted(map(lambda el : (el[1]['date'], el[0]), data.tags.items()))))
for tag in tags_sorted_by_date_desc:
f.write('<tr><td>%s</td><td>%s</td></tr>' % (tag, data.tags[tag]['date']))
f.write('</table>')