|
|
@@ -48,6 +48,7 @@ conf = {
|
|
48
|
48
|
'project_name': '',
|
|
49
|
49
|
'merge_authors': {},
|
|
50
|
50
|
'processes': 8,
|
|
|
51
|
+ 'start_date': ''
|
|
51
|
52
|
}
|
|
52
|
53
|
|
|
53
|
54
|
def getpipeoutput(cmds, quiet = False):
|
|
|
@@ -72,6 +73,12 @@ def getpipeoutput(cmds, quiet = False):
|
|
72
|
73
|
exectime_external += (end - start)
|
|
73
|
74
|
return output.rstrip('\n')
|
|
74
|
75
|
|
|
|
76
|
+def getlogrange(defaultrange = 'HEAD', end_only = True):
|
|
|
77
|
+ commit_range = getcommitrange(defaultrange, end_only)
|
|
|
78
|
+ if len(conf['start_date']) > 0:
|
|
|
79
|
+ return '--since=%s %s' % (conf['start_date'], commit_range)
|
|
|
80
|
+ return commit_range
|
|
|
81
|
+
|
|
75
|
82
|
def getcommitrange(defaultrange = 'HEAD', end_only = False):
|
|
76
|
83
|
if len(conf['commit_end']) > 0:
|
|
77
|
84
|
if end_only or len(conf['commit_begin']) == 0:
|
|
|
@@ -280,7 +287,7 @@ class GitDataCollector(DataCollector):
|
|
280
|
287
|
def collect(self, dir):
|
|
281
|
288
|
DataCollector.collect(self, dir)
|
|
282
|
289
|
|
|
283
|
|
- self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getcommitrange(), 'wc -l']))
|
|
|
290
|
+ self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), 'wc -l']))
|
|
284
|
291
|
#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l'))
|
|
285
|
292
|
|
|
286
|
293
|
# tags
|
|
|
@@ -323,7 +330,7 @@ class GitDataCollector(DataCollector):
|
|
323
|
330
|
|
|
324
|
331
|
# Collect revision statistics
|
|
325
|
332
|
# Outputs "<stamp> <date> <time> <timezone> <author> '<' <mail> '>'"
|
|
326
|
|
- lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getcommitrange('HEAD'), 'grep -v ^commit']).split('\n')
|
|
|
333
|
+ lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getlogrange('HEAD'), 'grep -v ^commit']).split('\n')
|
|
327
|
334
|
for line in lines:
|
|
328
|
335
|
parts = line.split(' ', 4)
|
|
329
|
336
|
author = ''
|
|
|
@@ -432,7 +439,7 @@ class GitDataCollector(DataCollector):
|
|
432
|
439
|
self.commits_by_timezone[timezone] = self.commits_by_timezone.get(timezone, 0) + 1
|
|
433
|
440
|
|
|
434
|
441
|
# outputs "<stamp> <files>" for each revision
|
|
435
|
|
- revlines = getpipeoutput(['git rev-list --pretty=format:"%%at %%T" %s' % getcommitrange('HEAD'), 'grep -v ^commit']).strip().split('\n')
|
|
|
442
|
+ revlines = getpipeoutput(['git rev-list --pretty=format:"%%at %%T" %s' % getlogrange('HEAD'), 'grep -v ^commit']).strip().split('\n')
|
|
436
|
443
|
lines = []
|
|
437
|
444
|
revs_to_read = []
|
|
438
|
445
|
time_rev_count = []
|
|
|
@@ -534,7 +541,7 @@ class GitDataCollector(DataCollector):
|
|
534
|
541
|
extra = ''
|
|
535
|
542
|
if conf['linear_linestats']:
|
|
536
|
543
|
extra = '--first-parent -m'
|
|
537
|
|
- lines = getpipeoutput(['git log --shortstat %s --pretty=format:"%%at %%aN" %s' % (extra, getcommitrange('HEAD'))]).split('\n')
|
|
|
544
|
+ lines = getpipeoutput(['git log --shortstat %s --pretty=format:"%%at %%aN" %s' % (extra, getlogrange('HEAD'))]).split('\n')
|
|
538
|
545
|
lines.reverse()
|
|
539
|
546
|
files = 0; inserted = 0; deleted = 0; total_lines = 0
|
|
540
|
547
|
author = None
|
|
|
@@ -590,7 +597,7 @@ class GitDataCollector(DataCollector):
|
|
590
|
597
|
# Similar to the above, but never use --first-parent
|
|
591
|
598
|
# (we need to walk through every commit to know who
|
|
592
|
599
|
# committed what, not just through mainline)
|
|
593
|
|
- lines = getpipeoutput(['git log --shortstat --date-order --pretty=format:"%%at %%aN" %s' % (getcommitrange('HEAD'))]).split('\n')
|
|
|
600
|
+ lines = getpipeoutput(['git log --shortstat --date-order --pretty=format:"%%at %%aN" %s' % (getlogrange('HEAD'))]).split('\n')
|
|
594
|
601
|
lines.reverse()
|
|
595
|
602
|
files = 0; inserted = 0; deleted = 0
|
|
596
|
603
|
author = None
|