|
|
@@ -240,26 +240,27 @@ class GitDataCollector(DataCollector):
|
|
240
|
240
|
|
|
241
|
241
|
# line statistics
|
|
242
|
242
|
# outputs:
|
|
243
|
|
- # <stamp> <author>
|
|
244
|
243
|
# N files changed, N insertions (+), N deletions(-)
|
|
|
244
|
+ # <stamp> <author>
|
|
245
|
245
|
self.changes_by_date = {} # stamp -> { files, ins, del }
|
|
246
|
|
- lines = getoutput('git-log --shortstat --pretty=format:"%at %an"').split('\n')
|
|
247
|
|
- # TODO |tac this and go it through in reverse, to calculate total lines in each rev?
|
|
248
|
|
- stamp = 0
|
|
249
|
|
- author = ''
|
|
|
246
|
+ lines = getoutput('git-log --shortstat --pretty=format:"%at %an" |tac').split('\n')
|
|
|
247
|
+ files = 0; inserted = 0; deleted = 0; total_lines = 0
|
|
250
|
248
|
for line in lines:
|
|
251
|
249
|
# <stamp> <author>
|
|
252
|
250
|
if line.find(',') == -1:
|
|
253
|
251
|
pos = line.find(' ')
|
|
254
|
252
|
(stamp, author) = (line[:pos], line[pos+1:])
|
|
|
253
|
+ self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted, 'lines': total_lines }
|
|
255
|
254
|
else:
|
|
256
|
255
|
numbers = re.findall('\d+', line)
|
|
257
|
256
|
if len(numbers) == 3:
|
|
258
|
|
- (files, inserted, deleted) = numbers
|
|
|
257
|
+ (files, inserted, deleted) = map(lambda el : int(el), numbers)
|
|
|
258
|
+ total_lines += inserted
|
|
|
259
|
+ total_lines -= deleted
|
|
259
|
260
|
else:
|
|
260
|
261
|
print 'Warning: failed to handle line "%s"' % line
|
|
261
|
262
|
(files, inserted, deleted) = (0, 0, 0)
|
|
262
|
|
- self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted }
|
|
|
263
|
+ #self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted }
|
|
263
|
264
|
|
|
264
|
265
|
def getActivityByDayOfWeek(self):
|
|
265
|
266
|
return self.activity_by_day_of_week
|
|
|
@@ -407,7 +408,10 @@ class HTMLReportCreator(ReportCreator):
|
|
407
|
408
|
f.write('<tr><th>Day</th><th>Total (%)</th></tr>')
|
|
408
|
409
|
fp = open(path + '/day_of_week.dat', 'w')
|
|
409
|
410
|
for d in range(0, 7):
|
|
410
|
|
- fp.write('%d %d\n' % (d + 1, day_of_week[d]))
|
|
|
411
|
+ commits = 0
|
|
|
412
|
+ if d in day_of_week:
|
|
|
413
|
+ commits = day_of_week[d]
|
|
|
414
|
+ fp.write('%d %d\n' % (d + 1, commits))
|
|
411
|
415
|
f.write('<tr>')
|
|
412
|
416
|
f.write('<th>%d</th>' % (d + 1))
|
|
413
|
417
|
if d in day_of_week:
|