|
|
@@ -7,6 +7,8 @@ import os
|
|
7
|
7
|
import re
|
|
8
|
8
|
import sys
|
|
9
|
9
|
|
|
|
10
|
+GNUPLOT_COMMON = 'set terminal png\nset size 0.5,0.5\n'
|
|
|
11
|
+
|
|
10
|
12
|
def getoutput(cmd):
|
|
11
|
13
|
print '>> %s' % cmd
|
|
12
|
14
|
output = commands.getoutput(cmd)
|
|
|
@@ -89,6 +91,8 @@ class GitDataCollector(DataCollector):
|
|
89
|
91
|
self.tags = {}
|
|
90
|
92
|
lines = getoutput('git-show-ref --tags').split('\n')
|
|
91
|
93
|
for line in lines:
|
|
|
94
|
+ if len(line) == 0:
|
|
|
95
|
+ continue
|
|
92
|
96
|
(hash, tag) = line.split(' ')
|
|
93
|
97
|
tag = tag.replace('refs/tags/', '')
|
|
94
|
98
|
output = getoutput('git-log "%s" --pretty=format:"%%at %%an" -n 1' % hash)
|
|
|
@@ -326,6 +330,11 @@ class HTMLReportCreator(ReportCreator):
|
|
326
|
330
|
for yy in reversed(sorted(data.commits_by_year.keys())):
|
|
327
|
331
|
f.write('<tr><td>%s</td><td>%d (%.2f%%)</td></tr>' % (yy, data.commits_by_year[yy], (100.0 * data.commits_by_year[yy]) / data.getTotalCommits()))
|
|
328
|
332
|
f.write('</table>')
|
|
|
333
|
+ f.write('<img src="commits_by_year.png" />')
|
|
|
334
|
+ fg = open(path + '/commits_by_year.dat', 'w')
|
|
|
335
|
+ for yy in sorted(data.commits_by_year.keys()):
|
|
|
336
|
+ fg.write('%d %d\n' % (yy, data.commits_by_year[yy]))
|
|
|
337
|
+ fg.close()
|
|
329
|
338
|
|
|
330
|
339
|
f.write('</body></html>')
|
|
331
|
340
|
f.close()
|
|
|
@@ -372,6 +381,18 @@ class HTMLReportCreator(ReportCreator):
|
|
372
|
381
|
f.write('</body></html>')
|
|
373
|
382
|
f.close()
|
|
374
|
383
|
|
|
|
384
|
+ ###
|
|
|
385
|
+ # Files
|
|
|
386
|
+ f = open(path + '/files.html', 'w')
|
|
|
387
|
+ self.printHeader(f)
|
|
|
388
|
+ f.write('<h1>Files</h1>')
|
|
|
389
|
+ self.printNav(f)
|
|
|
390
|
+
|
|
|
391
|
+ f.write('<h2>File count by date</h2>')
|
|
|
392
|
+
|
|
|
393
|
+ f.write('</body></html>')
|
|
|
394
|
+ f.close()
|
|
|
395
|
+
|
|
375
|
396
|
###
|
|
376
|
397
|
# tags.html
|
|
377
|
398
|
f = open(path + '/tags.html', 'w')
|
|
|
@@ -381,7 +402,8 @@ class HTMLReportCreator(ReportCreator):
|
|
381
|
402
|
|
|
382
|
403
|
f.write('<dl>')
|
|
383
|
404
|
f.write('<dt>Total tags</dt><dd>%d</dd>' % len(data.tags))
|
|
384
|
|
- f.write('<dt>Average commits per tag</dt><dd>%.2f</dd>' % (data.getTotalCommits() / len(data.tags)))
|
|
|
405
|
+ if len(data.tags) > 0:
|
|
|
406
|
+ f.write('<dt>Average commits per tag</dt><dd>%.2f</dd>' % (data.getTotalCommits() / len(data.tags)))
|
|
385
|
407
|
f.write('</dl>')
|
|
386
|
408
|
|
|
387
|
409
|
f.write('<table>')
|
|
|
@@ -394,7 +416,24 @@ class HTMLReportCreator(ReportCreator):
|
|
394
|
416
|
|
|
395
|
417
|
f.write('</body></html>')
|
|
396
|
418
|
f.close()
|
|
|
419
|
+
|
|
|
420
|
+ self.createGraphs(path)
|
|
397
|
421
|
pass
|
|
|
422
|
+
|
|
|
423
|
+ def createGraphs(self, path):
|
|
|
424
|
+ # commits_by_year
|
|
|
425
|
+ f = open(path + '/commits_by_year.plot', 'w')
|
|
|
426
|
+ f.write(GNUPLOT_COMMON)
|
|
|
427
|
+ f.write('set output \'commits_by_year.png\'\n')
|
|
|
428
|
+ f.write('unset key\n')
|
|
|
429
|
+ f.write('set xtics 1\n')
|
|
|
430
|
+ f.write('plot \'commits_by_year.dat\' using 1:2 w lp')
|
|
|
431
|
+ f.close()
|
|
|
432
|
+
|
|
|
433
|
+ os.chdir(path)
|
|
|
434
|
+ os.system('gnuplot commits_by_year.plot')
|
|
|
435
|
+
|
|
|
436
|
+ pass
|
|
398
|
437
|
|
|
399
|
438
|
def printHeader(self, f):
|
|
400
|
439
|
f.write("""<html>
|