|
|
@@ -237,6 +237,29 @@ class GitDataCollector(DataCollector):
|
|
237
|
237
|
self.extensions[ext]['lines'] += int(getoutput('wc -l < %s' % line, quiet = True))
|
|
238
|
238
|
except:
|
|
239
|
239
|
print 'Warning: Could not count lines for file "%s"' % line
|
|
|
240
|
+
|
|
|
241
|
+ # line statistics
|
|
|
242
|
+ # outputs:
|
|
|
243
|
+ # <stamp> <author>
|
|
|
244
|
+ # N files changed, N insertions (+), N deletions(-)
|
|
|
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 = ''
|
|
|
250
|
+ for line in lines:
|
|
|
251
|
+ # <stamp> <author>
|
|
|
252
|
+ if line.find(',') == -1:
|
|
|
253
|
+ pos = line.find(' ')
|
|
|
254
|
+ (stamp, author) = (line[:pos], line[pos+1:])
|
|
|
255
|
+ else:
|
|
|
256
|
+ numbers = re.findall('\d+', line)
|
|
|
257
|
+ if len(numbers) == 3:
|
|
|
258
|
+ (files, inserted, deleted) = numbers
|
|
|
259
|
+ else:
|
|
|
260
|
+ print 'Warning: failed to handle line "%s"' % line
|
|
|
261
|
+ (files, inserted, deleted) = (0, 0, 0)
|
|
|
262
|
+ self.changes_by_date[stamp] = { 'files': files, 'ins': inserted, 'del': deleted }
|
|
240
|
263
|
|
|
241
|
264
|
def getActivityByDayOfWeek(self):
|
|
242
|
265
|
return self.activity_by_day_of_week
|