Sfoglia il codice sorgente

List of Authors: added "# by commits" column.

Heikki Hokkanen 18 anni fa
parent
commit
f9fa40d813
2 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. 0
    1
      doc/TODO.txt
  2. 7
    3
      gitstats

+ 0
- 1
doc/TODO.txt Vedi File

@@ -36,7 +36,6 @@
36 36
 - Authors
37 37
 	- (T) List of authors
38 38
 		- Lines
39
-		- Position by nrof commits
40 39
 	- (T) Author of Month
41 40
 		- Lines
42 41
 	- (T) Author of Year

+ 7
- 3
gitstats Vedi File

@@ -32,7 +32,9 @@ def getoutput(cmd, quiet = False):
32 32
 def getkeyssortedbyvalues(dict):
33 33
 	return map(lambda el : el[1], sorted(map(lambda el : (el[1], el[0]), dict.items())))
34 34
 
35
-# TODO getdictkeyssortedbyvaluekey(dict, key) - eg. dict['author'] = { 'commits' : 512 } - ...key(dict, 'commits')
35
+# dict['author'] = { 'commits': 512 } - ...key(dict, 'commits')
36
+def getkeyssortedbyvaluekey(d, key):
37
+	return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
36 38
 
37 39
 class DataCollector:
38 40
 	"""Manages data collection from a revision control repository."""
@@ -527,10 +529,12 @@ class HTMLReportCreator(ReportCreator):
527 529
 		f.write(html_header(2, 'List of Authors'))
528 530
 
529 531
 		f.write('<table class="authors">')
530
-		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th>Age</th></tr>')
532
+		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th>Age</th><th># by commits</th></tr>')
533
+		authors_by_commits = getkeyssortedbyvaluekey(data.authors, 'commits')
534
+		authors_by_commits.reverse() # most first
531 535
 		for author in sorted(data.getAuthors()):
532 536
 			info = data.getAuthorInfo(author)
533
-			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td><td>%s</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last'], info['timedelta']))
537
+			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last'], info['timedelta'], authors_by_commits.index(author) + 1))
534 538
 		f.write('</table>')
535 539
 
536 540
 		# Authors :: Author of Month