Kaynağa Gözat

More function stubs.

Heikki Hokkanen 18 yıl önce
ebeveyn
işleme
80e5e8d309
2 değiştirilmiş dosya ile 20 ekleme ve 6 silme
  1. 6
    3
      TODO.txt
  2. 14
    3
      statgit

+ 6
- 3
TODO.txt Dosyayı Görüntüle

@@ -26,15 +26,18 @@
26 26
 [Stats]
27 27
 - General
28 28
 	- Report Period (git-log)
29
-	- Total Files (git-ls-files)
30
-	- Total LOC?
31
-	- Authors
29
+	- DONE Total Files (git-ls-files)
30
+	- WIP Total LOC?
31
+	- DONE Total Commits
32
+	- DONE Authors
32 33
 
33 34
 - Authors
34 35
 	- List of authors
35 36
 	- (T): author, commits (%), LOC?, first commit, last commit
36 37
 	- (T): Developer of the Month: month, author, commits, LOC?
37 38
 
39
+- (G) Lines of Code: x = date, y = lines
40
+
38 41
 - Tags
39 42
 	- (T): Name, Date, LOC?, Developers
40 43
 

+ 14
- 3
statgit Dosyayı Görüntüle

@@ -24,6 +24,12 @@ class DataCollector:
24 24
 	def getAuthors(self):
25 25
 		return []
26 26
 	
27
+	def getFirstCommitDate(self):
28
+		return datetime.datetime.now()
29
+	
30
+	def getLastCommitDate(self):
31
+		return datetime.datetime.now()
32
+	
27 33
 	def getTotalAuthors(self):
28 34
 		return -1
29 35
 	
@@ -57,7 +63,9 @@ class GitDataCollector(DataCollector):
57 63
 	def getTotalFiles(self):
58 64
 		files = commands.getoutput('git-ls-files |wc -l')
59 65
 		return int(files)
60
-	pass
66
+	
67
+	def getTotalLOC(self):
68
+		return int(commands.getoutput('git-ls-files |xargs cat |wc -l'))
61 69
 
62 70
 class ReportCreator:
63 71
 	def __init__(self):
@@ -78,12 +86,13 @@ class HTMLReportCreator(ReportCreator):
78 86
 </head>
79 87
 <body>
80 88
 """)
89
+		format = '%Y-%m-%d %H:%m:%S'
81 90
 
82 91
 		f.write('<h1>StatGit</h1>')
83 92
 
84 93
 		f.write('<dl>');
85
-		f.write('<dt>Generated</dt><dd>%s</dd>' % datetime.datetime.now().strftime('%Y-%m-%d %H:%m:%S'));
86
-		f.write('<dt>Report Period</dt><dd>%s to %s</dd>' % ('0000-00-00', '0000-00-00'))
94
+		f.write('<dt>Generated</dt><dd>%s</dd>' % datetime.datetime.now().strftime(format));
95
+		f.write('<dt>Report Period</dt><dd>%s to %s</dd>' % (data.getFirstCommitDate().strftime(format), data.getLastCommitDate().strftime(format)))
87 96
 		f.write('<dt>Total Files</dt><dd>%s</dd>' % data.getTotalFiles())
88 97
 		f.write('<dt>Total Lines of Code</dt><dd>%s</dd>' % data.getTotalLOC())
89 98
 		f.write('<dt>Total Commits</dt><dd>%s</dd>' % data.getTotalCommits())
@@ -99,6 +108,8 @@ class HTMLReportCreator(ReportCreator):
99 108
 			f.write('<tr><td>%s</td><td>%d (%.2f)</td><td>%s</td><td>%s</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last']))
100 109
 		f.write('</table>')
101 110
 
111
+		f.write('<h2>Tags</h2>')
112
+
102 113
 		f.write('</body>\n</html>');
103 114
 		f.close()
104 115
 	pass