|
|
@@ -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
|