|
|
@@ -246,10 +246,13 @@ class GitDataCollector(DataCollector):
|
|
246
|
246
|
lines = getoutput('git-log --shortstat --pretty=format:"%at %an" |tac').split('\n')
|
|
247
|
247
|
files = 0; inserted = 0; deleted = 0; total_lines = 0
|
|
248
|
248
|
for line in lines:
|
|
|
249
|
+ if len(line) == 0:
|
|
|
250
|
+ continue
|
|
|
251
|
+
|
|
249
|
252
|
# <stamp> <author>
|
|
250
|
253
|
if line.find(',') == -1:
|
|
251
|
254
|
pos = line.find(' ')
|
|
252
|
|
- (stamp, author) = (line[:pos], line[pos+1:])
|
|
|
255
|
+ (stamp, author) = (int(line[:pos]), line[pos+1:])
|
|
253
|
256
|
self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted, 'lines': total_lines }
|
|
254
|
257
|
else:
|
|
255
|
258
|
numbers = re.findall('\d+', line)
|
|
|
@@ -581,6 +584,14 @@ class HTMLReportCreator(ReportCreator):
|
|
581
|
584
|
f.write('<dt>Total lines</dt><dd>%d</dd>' % data.getTotalLOC())
|
|
582
|
585
|
f.write('</dl>\n')
|
|
583
|
586
|
|
|
|
587
|
+ f.write(html_header(2, 'Lines of Code'))
|
|
|
588
|
+ f.write('<img src="lines_of_code.png" />')
|
|
|
589
|
+
|
|
|
590
|
+ fg = open(path + '/lines_of_code.dat', 'w')
|
|
|
591
|
+ for stamp in sorted(data.changes_by_date.keys()):
|
|
|
592
|
+ fg.write('%d %d\n' % (stamp, data.changes_by_date[stamp]['lines']))
|
|
|
593
|
+ fg.close()
|
|
|
594
|
+
|
|
584
|
595
|
f.write('</body></html>')
|
|
585
|
596
|
f.close()
|
|
586
|
597
|
|
|
|
@@ -701,6 +712,22 @@ plot 'files_by_date.dat' using 1:2 smooth csplines
|
|
701
|
712
|
""")
|
|
702
|
713
|
f.close()
|
|
703
|
714
|
|
|
|
715
|
+ # Lines of Code
|
|
|
716
|
+ f = open(path + '/lines_of_code.plot', 'w')
|
|
|
717
|
+ f.write(GNUPLOT_COMMON)
|
|
|
718
|
+ f.write(
|
|
|
719
|
+"""
|
|
|
720
|
+set output 'lines_of_code.png'
|
|
|
721
|
+unset key
|
|
|
722
|
+set xdata time
|
|
|
723
|
+set timefmt "%s"
|
|
|
724
|
+set format x "%Y-%m-%d"
|
|
|
725
|
+set ylabel "Lines"
|
|
|
726
|
+set xtics rotate by 90
|
|
|
727
|
+plot 'lines_of_code.dat' using 1:2 w lines
|
|
|
728
|
+""")
|
|
|
729
|
+ f.close()
|
|
|
730
|
+
|
|
704
|
731
|
os.chdir(path)
|
|
705
|
732
|
files = glob.glob(path + '/*.plot')
|
|
706
|
733
|
for f in files:
|