From b825e4323fead2691131fc68f7ba0d84a2fe7afc Mon Sep 17 00:00:00 2001 From: Heikki Hokkanen Date: Sun, 5 Aug 2007 15:45:01 +0300 Subject: [PATCH] Author of Year: Commits (%). Sort tags date/desc & list general info. --- statgit | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/statgit b/statgit index 2dc54d5..740fb2b 100755 --- a/statgit +++ b/statgit @@ -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('%s%s%d' % (yy, authors[0], commits)) + f.write('%s%s%d (%.2f%% of %d)' % (yy, authors[0], commits, (100 * commits) / data.commits_by_year[yy], data.commits_by_year[yy])) f.write('') f.write('') @@ -356,9 +361,16 @@ class HTMLReportCreator(ReportCreator): f.write('

Tags

') self.printNav(f) + f.write('
') + f.write('
Total tags
%d
' % len(data.tags)) + f.write('
Average commits per tag
%.2f
' % (data.getTotalCommits() / len(data.tags))) + f.write('
') + f.write('') f.write('') - 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('' % (tag, data.tags[tag]['date'])) f.write('
NameDate
%s%s
') -- 2.11.4.GIT