|
|
@@ -3,6 +3,7 @@
|
|
3
|
3
|
# GPLv2
|
|
4
|
4
|
import commands
|
|
5
|
5
|
import datetime
|
|
|
6
|
+import glob
|
|
6
|
7
|
import os
|
|
7
|
8
|
import re
|
|
8
|
9
|
import sys
|
|
|
@@ -193,6 +194,16 @@ class GitDataCollector(DataCollector):
|
|
193
|
194
|
self.commits_by_year[yy] += 1
|
|
194
|
195
|
else:
|
|
195
|
196
|
self.commits_by_year[yy] = 1
|
|
|
197
|
+
|
|
|
198
|
+ # outputs "<stamp> <files>" for each revision
|
|
|
199
|
+ self.files_by_stamp = {} # stamp -> files
|
|
|
200
|
+ lines = getoutput('git-rev-list --pretty=format:"%at %H" HEAD |grep -v ^commit |while read line; do set $line; echo "$1 $(git-ls-tree -r "$2" |wc -l)"; done').split('\n')
|
|
|
201
|
+ for line in lines:
|
|
|
202
|
+ parts = line.split(' ')
|
|
|
203
|
+ if len(parts) != 2:
|
|
|
204
|
+ continue
|
|
|
205
|
+ (stamp, files) = parts[0:2]
|
|
|
206
|
+ self.files_by_stamp[int(stamp)] = int(files)
|
|
196
|
207
|
|
|
197
|
208
|
def getActivityByDayOfWeek(self):
|
|
198
|
209
|
return self.activity_by_day_of_week
|
|
|
@@ -438,6 +449,13 @@ class HTMLReportCreator(ReportCreator):
|
|
438
|
449
|
|
|
439
|
450
|
f.write('<h2>File count by date</h2>')
|
|
440
|
451
|
|
|
|
452
|
+ fg = open(path + '/files_by_date.dat', 'w')
|
|
|
453
|
+ for stamp in sorted(data.files_by_stamp.keys()):
|
|
|
454
|
+ fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp]))
|
|
|
455
|
+ fg.close()
|
|
|
456
|
+
|
|
|
457
|
+ f.write('<img src="files_by_date.png" />')
|
|
|
458
|
+
|
|
441
|
459
|
f.write('<h2>Average file size by date</h2>')
|
|
442
|
460
|
|
|
443
|
461
|
f.write('</body></html>')
|
|
|
@@ -545,10 +563,27 @@ plot 'commits_by_year.dat' using 1:2:(0.5) w boxes fs solid
|
|
545
|
563
|
""")
|
|
546
|
564
|
f.close()
|
|
547
|
565
|
|
|
|
566
|
+ # Files by date
|
|
|
567
|
+ f = open(path + '/files_by_date.plot', 'w')
|
|
|
568
|
+ f.write(GNUPLOT_COMMON)
|
|
|
569
|
+ f.write(
|
|
|
570
|
+"""
|
|
|
571
|
+set output 'files_by_date.png'
|
|
|
572
|
+unset key
|
|
|
573
|
+set xdata time
|
|
|
574
|
+set timefmt "%Y-%m-%d"
|
|
|
575
|
+set format x "%Y-%m-%d"
|
|
|
576
|
+set ylabel "Files"
|
|
|
577
|
+set xtics rotate by 90
|
|
|
578
|
+plot 'files_by_date.dat' using 1:2 smooth csplines
|
|
|
579
|
+""")
|
|
|
580
|
+ f.close()
|
|
|
581
|
+
|
|
548
|
582
|
os.chdir(path)
|
|
549
|
|
- for i in ('hour_of_day', 'day_of_week', 'month_of_year', 'commits_by_year_month', 'commits_by_year'):
|
|
550
|
|
- print '>> gnuplot %s.plot' % i
|
|
551
|
|
- os.system('gnuplot %s.plot' % i)
|
|
|
583
|
+ files = glob.glob(path + '/*.plot')
|
|
|
584
|
+ for f in files:
|
|
|
585
|
+ print '>> gnuplot %s' % os.path.basename(f)
|
|
|
586
|
+ os.system('gnuplot %s' % f)
|
|
552
|
587
|
|
|
553
|
588
|
def printHeader(self, f):
|
|
554
|
589
|
f.write("""<html>
|