|
|
@@ -373,7 +373,7 @@ class GitDataCollector(DataCollector):
|
|
373
|
373
|
|
|
374
|
374
|
self.extensions[ext]['files'] += 1
|
|
375
|
375
|
try:
|
|
376
|
|
- self.extensions[ext]['lines'] += int(getpipeoutput(['git cat-file blob %s' % sha1, 'wc -l']).split()[0])
|
|
|
376
|
+ self.extensions[ext]['lines'] += self.getLinesInBlob(sha1)
|
|
377
|
377
|
except:
|
|
378
|
378
|
print 'Warning: Could not count lines for file "%s"' % line
|
|
379
|
379
|
|
|
|
@@ -478,6 +478,16 @@ class GitDataCollector(DataCollector):
|
|
478
|
478
|
def getLastCommitDate(self):
|
|
479
|
479
|
return datetime.datetime.fromtimestamp(self.last_commit_stamp)
|
|
480
|
480
|
|
|
|
481
|
+ def getLinesInBlob(self, sha1):
|
|
|
482
|
+ try:
|
|
|
483
|
+ res = self.cache['lines_in_blob'][sha1]
|
|
|
484
|
+ except:
|
|
|
485
|
+ res = int(getpipeoutput(['git cat-file blob %s' % sha1, 'wc -l']).split()[0])
|
|
|
486
|
+ if 'lines_in_blob' not in self.cache:
|
|
|
487
|
+ self.cache['lines_in_blob'] = {}
|
|
|
488
|
+ self.cache['lines_in_blob'][sha1] = res
|
|
|
489
|
+ return res
|
|
|
490
|
+
|
|
481
|
491
|
def getTags(self):
|
|
482
|
492
|
lines = getpipeoutput(['git show-ref --tags', 'cut -d/ -f3'])
|
|
483
|
493
|
return lines.split('\n')
|