|
|
|
|
|
|
116
|
self.author_of_year = {} # year -> author -> commits
|
116
|
self.author_of_year = {} # year -> author -> commits
|
|
117
|
self.commits_by_month = {} # month -> commits
|
117
|
self.commits_by_month = {} # month -> commits
|
|
118
|
self.commits_by_year = {} # year -> commits
|
118
|
self.commits_by_year = {} # year -> commits
|
|
|
|
119
|
+ self.lines_added_by_month = {} # month -> lines added
|
|
|
|
120
|
+ self.lines_added_by_year = {} # year -> lines added
|
|
|
|
121
|
+ self.lines_removed_by_month = {} # month -> lines removed
|
|
|
|
122
|
+ self.lines_removed_by_year = {} # year -> lines removed
|
|
119
|
self.first_commit_stamp = 0
|
123
|
self.first_commit_stamp = 0
|
|
120
|
self.last_commit_stamp = 0
|
124
|
self.last_commit_stamp = 0
|
|
121
|
self.last_active_day = None
|
125
|
self.last_active_day = None
|
|
|
|
|
|
|
449
|
try:
|
453
|
try:
|
|
450
|
(stamp, author) = (int(line[:pos]), line[pos+1:])
|
454
|
(stamp, author) = (int(line[:pos]), line[pos+1:])
|
|
451
|
self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted, 'lines': total_lines }
|
455
|
self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted, 'lines': total_lines }
|
|
|
|
456
|
+
|
|
|
|
457
|
+ date = datetime.datetime.fromtimestamp(stamp)
|
|
|
|
458
|
+ yymm = date.strftime('%Y-%m')
|
|
|
|
459
|
+ self.lines_added_by_month[yymm] = self.lines_added_by_month.get(yymm, 0) + inserted
|
|
|
|
460
|
+ self.lines_removed_by_month[yymm] = self.lines_removed_by_month.get(yymm, 0) + deleted
|
|
|
|
461
|
+
|
|
|
|
462
|
+ yy = date.year
|
|
|
|
463
|
+ self.lines_added_by_year[yy] = self.lines_added_by_year.get(yy,0) + inserted
|
|
|
|
464
|
+ self.lines_removed_by_year[yy] = self.lines_removed_by_year.get(yy, 0) + deleted
|
|
|
|
465
|
+
|
|
452
|
files, inserted, deleted = 0, 0, 0
|
466
|
files, inserted, deleted = 0, 0, 0
|
|
453
|
except ValueError:
|
467
|
except ValueError:
|
|
454
|
print 'Warning: unexpected line "%s"' % line
|
468
|
print 'Warning: unexpected line "%s"' % line
|
|
|
|
|
|
|
462
|
total_lines -= deleted
|
476
|
total_lines -= deleted
|
|
463
|
self.total_lines_added += inserted
|
477
|
self.total_lines_added += inserted
|
|
464
|
self.total_lines_removed += deleted
|
478
|
self.total_lines_removed += deleted
|
|
|
|
479
|
+
|
|
465
|
else:
|
480
|
else:
|
|
466
|
print 'Warning: failed to handle line "%s"' % line
|
481
|
print 'Warning: failed to handle line "%s"' % line
|
|
467
|
(files, inserted, deleted) = (0, 0, 0)
|
482
|
(files, inserted, deleted) = (0, 0, 0)
|
|
|
|
|
|
|
817
|
|
832
|
|
|
818
|
# Commits by year/month
|
833
|
# Commits by year/month
|
|
819
|
f.write(html_header(2, 'Commits by year/month'))
|
834
|
f.write(html_header(2, 'Commits by year/month'))
|
|
820
|
- f.write('<div class="vtable"><table><tr><th>Month</th><th>Commits</th></tr>')
|
|
|
|
|
|
835
|
+ f.write('<div class="vtable"><table><tr><th>Month</th><th>Commits</th><th>Lines added</th><th>Lines removed</th></tr>')
|
|
821
|
for yymm in reversed(sorted(data.commits_by_month.keys())):
|
836
|
for yymm in reversed(sorted(data.commits_by_month.keys())):
|
|
822
|
- f.write('<tr><td>%s</td><td>%d</td></tr>' % (yymm, data.commits_by_month[yymm]))
|
|
|
|
|
|
837
|
+ f.write('<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td></tr>' % (yymm, data.commits_by_month[yymm], data.lines_added_by_month[yymm], data.lines_removed_by_month[yymm]))
|
|
823
|
f.write('</table></div>')
|
838
|
f.write('</table></div>')
|
|
824
|
f.write('<img src="commits_by_year_month.png" alt="Commits by year/month" />')
|
839
|
f.write('<img src="commits_by_year_month.png" alt="Commits by year/month" />')
|
|
825
|
fg = open(path + '/commits_by_year_month.dat', 'w')
|
840
|
fg = open(path + '/commits_by_year_month.dat', 'w')
|
|
|
|
|
|
|
829
|
|
844
|
|
|
830
|
# Commits by year
|
845
|
# Commits by year
|
|
831
|
f.write(html_header(2, 'Commits by Year'))
|
846
|
f.write(html_header(2, 'Commits by Year'))
|
|
832
|
- f.write('<div class="vtable"><table><tr><th>Year</th><th>Commits (% of all)</th></tr>')
|
|
|
|
|
|
847
|
+ f.write('<div class="vtable"><table><tr><th>Year</th><th>Commits (% of all)</th><th>Lines added</th><th>Lines removed</th></tr>')
|
|
833
|
for yy in reversed(sorted(data.commits_by_year.keys())):
|
848
|
for yy in reversed(sorted(data.commits_by_year.keys())):
|
|
834
|
- 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()))
|
|
|
|
|
|
849
|
+ f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%d</td><td>%d</td></tr>' % (yy, data.commits_by_year[yy], (100.0 * data.commits_by_year[yy]) / data.getTotalCommits(), data.lines_added_by_year[yy], data.lines_removed_by_year[yy]))
|
|
835
|
f.write('</table></div>')
|
850
|
f.write('</table></div>')
|
|
836
|
f.write('<img src="commits_by_year.png" alt="Commits by Year" />')
|
851
|
f.write('<img src="commits_by_year.png" alt="Commits by Year" />')
|
|
837
|
fg = open(path + '/commits_by_year.dat', 'w')
|
852
|
fg = open(path + '/commits_by_year.dat', 'w')
|