Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
8bffbaa87e
1 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. 5
    4
      gitstats

+ 5
- 4
gitstats Dosyayı Görüntüle

@@ -33,6 +33,7 @@ conf = {
33 33
 	'max_ext_length': 10,
34 34
 	'style': 'gitstats.css',
35 35
 	'max_authors': 20,
36
+	'authors_top': 5,
36 37
 }
37 38
 
38 39
 def getpipeoutput(cmds, quiet = False):
@@ -786,25 +787,25 @@ class HTMLReportCreator(ReportCreator):
786 787
 		# Authors :: Author of Month
787 788
 		f.write(html_header(2, 'Author of Month'))
788 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 791
 		for yymm in reversed(sorted(data.author_of_month.keys())):
791 792
 			authordict = data.author_of_month[yymm]
792 793
 			authors = getkeyssortedbyvalues(authordict)
793 794
 			authors.reverse()
794 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 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 799
 		f.write('</table>')
799 800
 
800 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 803
 		for yy in reversed(sorted(data.author_of_year.keys())):
803 804
 			authordict = data.author_of_year[yy]
804 805
 			authors = getkeyssortedbyvalues(authordict)
805 806
 			authors.reverse()
806 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 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 810
 		f.write('</table>')
810 811