Browse Source

Make "Next top 5" configurable.

"-c authors_top=N" changes how many authors are shown on "Author of month" and
"Author of year".
Heikki Hokkanen 15 years ago
parent
commit
8bffbaa87e
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      gitstats

+ 5
- 4
gitstats View File

33
 	'max_ext_length': 10,
33
 	'max_ext_length': 10,
34
 	'style': 'gitstats.css',
34
 	'style': 'gitstats.css',
35
 	'max_authors': 20,
35
 	'max_authors': 20,
36
+	'authors_top': 5,
36
 }
37
 }
37
 
38
 
38
 def getpipeoutput(cmds, quiet = False):
39
 def getpipeoutput(cmds, quiet = False):
786
 		# Authors :: Author of Month
787
 		# Authors :: Author of Month
787
 		f.write(html_header(2, 'Author of Month'))
788
 		f.write(html_header(2, 'Author of Month'))
788
 		f.write('<table class="sortable" id="aom">')
789
 		f.write('<table class="sortable" id="aom">')
789
-		f.write('<tr><th>Month</th><th>Author</th><th>Commits (%)</th><th class="unsortable">Next top 5</th></tr>')
790
+		f.write('<tr><th>Month</th><th>Author</th><th>Commits (%%)</th><th class="unsortable">Next top %d</th></tr>' % conf['authors_top'])
790
 		for yymm in reversed(sorted(data.author_of_month.keys())):
791
 		for yymm in reversed(sorted(data.author_of_month.keys())):
791
 			authordict = data.author_of_month[yymm]
792
 			authordict = data.author_of_month[yymm]
792
 			authors = getkeyssortedbyvalues(authordict)
793
 			authors = getkeyssortedbyvalues(authordict)
793
 			authors.reverse()
794
 			authors.reverse()
794
 			commits = data.author_of_month[yymm][authors[0]]
795
 			commits = data.author_of_month[yymm][authors[0]]
795
-			next = ', '.join(authors[1:5])
796
+			next = ', '.join(authors[1:conf['authors_top']+1])
796
 			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))
797
 			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))
797
 
798
 
798
 		f.write('</table>')
799
 		f.write('</table>')
799
 
800
 
800
 		f.write(html_header(2, 'Author of Year'))
801
 		f.write(html_header(2, 'Author of Year'))
801
-		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>')
802
+		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'])
802
 		for yy in reversed(sorted(data.author_of_year.keys())):
803
 		for yy in reversed(sorted(data.author_of_year.keys())):
803
 			authordict = data.author_of_year[yy]
804
 			authordict = data.author_of_year[yy]
804
 			authors = getkeyssortedbyvalues(authordict)
805
 			authors = getkeyssortedbyvalues(authordict)
805
 			authors.reverse()
806
 			authors.reverse()
806
 			commits = data.author_of_year[yy][authors[0]]
807
 			commits = data.author_of_year[yy][authors[0]]
807
-			next = ', '.join(authors[1:5])
808
+			next = ', '.join(authors[1:conf['authors_top']+1])
808
 			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))
809
 			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))
809
 		f.write('</table>')
810
 		f.write('</table>')
810
 
811