Browse files

Make "Next top 5" configurable.

"-c authors_top=N" changes how many authors are shown on "Author of month" and
"Author of year".
  • Loading branch information...
1 parent 1a00daf commit 8bffbaa87e5cfd5c7a86b7631a95c64d2a5731dd @hoxu hoxu committed Apr 2, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 gitstats
View
9 gitstats
@@ -33,6 +33,7 @@ conf = {
'max_ext_length': 10,
'style': 'gitstats.css',
'max_authors': 20,
+ 'authors_top': 5,
}
def getpipeoutput(cmds, quiet = False):
@@ -786,25 +787,25 @@ class HTMLReportCreator(ReportCreator):
# Authors :: Author of Month
f.write(html_header(2, 'Author of Month'))
f.write('<table class="sortable" id="aom">')
- f.write('<tr><th>Month</th><th>Author</th><th>Commits (%)</th><th class="unsortable">Next top 5</th></tr>')
+ f.write('<tr><th>Month</th><th>Author</th><th>Commits (%%)</th><th class="unsortable">Next top %d</th></tr>' % conf['authors_top'])
for yymm in reversed(sorted(data.author_of_month.keys())):
authordict = data.author_of_month[yymm]
authors = getkeyssortedbyvalues(authordict)
authors.reverse()
commits = data.author_of_month[yymm][authors[0]]
- next = ', '.join(authors[1:5])
+ next = ', '.join(authors[1:conf['authors_top']+1])
f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td><td>%s</td></tr>' % (yymm, authors[0], commits, (100.0 * commits) / data.commits_by_month[yymm], data.commits_by_month[yymm], next))
f.write('</table>')
f.write(html_header(2, 'Author of Year'))
- f.write('<table class="sortable" id="aoy"><tr><th>Year</th><th>Author</th><th>Commits (%)</th><th class="unsortable">Next top 5</th></tr>')
+ f.write('<table class="sortable" id="aoy"><tr><th>Year</th><th>Author</th><th>Commits (%%)</th><th class="unsortable">Next top %d</th></tr>' % conf['authors_top'])
for yy in reversed(sorted(data.author_of_year.keys())):
authordict = data.author_of_year[yy]
authors = getkeyssortedbyvalues(authordict)
authors.reverse()
commits = data.author_of_year[yy][authors[0]]
- next = ', '.join(authors[1:5])
+ next = ', '.join(authors[1:conf['authors_top']+1])
f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td><td>%s</td></tr>' % (yy, authors[0], commits, (100.0 * commits) / data.commits_by_year[yy], data.commits_by_year[yy], next))
f.write('</table>')

0 comments on commit 8bffbaa

Please sign in to comment.