diff --git a/gitstats b/gitstats index 9e639df..0b444b7 100755 --- a/gitstats +++ b/gitstats @@ -48,6 +48,7 @@ conf = { 'project_name': '', 'merge_authors': {}, 'processes': 8, + 'start_date': '' } def getpipeoutput(cmds, quiet = False): @@ -72,6 +73,12 @@ def getpipeoutput(cmds, quiet = False): exectime_external += (end - start) return output.rstrip('\n') +def getlogrange(defaultrange = 'HEAD', end_only = True): + commit_range = getcommitrange(defaultrange, end_only) + if len(conf['start_date']) > 0: + return '--since=%s %s' % (conf['start_date'], commit_range) + return commit_range + def getcommitrange(defaultrange = 'HEAD', end_only = False): if len(conf['commit_end']) > 0: if end_only or len(conf['commit_begin']) == 0: @@ -280,7 +287,7 @@ class GitDataCollector(DataCollector): def collect(self, dir): DataCollector.collect(self, dir) - self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getcommitrange(), 'wc -l'])) + self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), 'wc -l'])) #self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l')) # tags @@ -323,7 +330,7 @@ class GitDataCollector(DataCollector): # Collect revision statistics # Outputs "