Add -y option to aggregate changes by year, not month
This commit is contained in:

committed by
Jonathan Corbet

parent
5f6452b1d0
commit
65cd32216f
@@ -19,9 +19,12 @@ class CSVStat:
|
|||||||
PeriodCommitHash = { }
|
PeriodCommitHash = { }
|
||||||
|
|
||||||
def AccumulatePatch (p, Aggregate):
|
def AccumulatePatch (p, Aggregate):
|
||||||
date = "%.2d-%.2d-01"%(p.date.year, p.date.month)
|
|
||||||
if (Aggregate == 'week'):
|
if (Aggregate == 'week'):
|
||||||
date = "%.2d-%.2d"%(p.date.isocalendar()[0], p.date.isocalendar()[1])
|
date = "%.2d-%.2d"%(p.date.isocalendar()[0], p.date.isocalendar()[1])
|
||||||
|
elif (Aggregate == 'year'):
|
||||||
|
date = "%.2d"%(p.date.year)
|
||||||
|
else:
|
||||||
|
date = "%.2d-%.2d-01"%(p.date.year, p.date.month)
|
||||||
authdatekey = "%s-%s"%(p.author.name, date)
|
authdatekey = "%s-%s"%(p.author.name, date)
|
||||||
if authdatekey not in PeriodCommitHash:
|
if authdatekey not in PeriodCommitHash:
|
||||||
empl = p.author.emailemployer (p.email, p.date)
|
empl = p.author.emailemployer (p.email, p.date)
|
||||||
|
5
gitdm
5
gitdm
@@ -62,6 +62,7 @@ ReportByFileType = 0
|
|||||||
# -u Map unknown employers to '(Unknown)'
|
# -u Map unknown employers to '(Unknown)'
|
||||||
# -x file.csv Export raw statistics as CSV
|
# -x file.csv Export raw statistics as CSV
|
||||||
# -w Aggregrate the raw statistics by weeks instead of months
|
# -w Aggregrate the raw statistics by weeks instead of months
|
||||||
|
# -y Aggregrate the raw statistics by years instead of months
|
||||||
# -z Dump out the hacker database at completion
|
# -z Dump out the hacker database at completion
|
||||||
|
|
||||||
def ParseOpts ():
|
def ParseOpts ():
|
||||||
@@ -70,7 +71,7 @@ def ParseOpts ():
|
|||||||
global CFName, CSVFile, CSVPrefix,DirName, Aggregate, Numstat
|
global CFName, CSVFile, CSVPrefix,DirName, Aggregate, Numstat
|
||||||
global ReportByFileType
|
global ReportByFileType
|
||||||
|
|
||||||
opts, rest = getopt.getopt (sys.argv[1:], 'ab:dc:Dh:l:no:p:r:stuwx:z')
|
opts, rest = getopt.getopt (sys.argv[1:], 'ab:dc:Dh:l:no:p:r:stuwx:yz')
|
||||||
for opt in opts:
|
for opt in opts:
|
||||||
if opt[0] == '-a':
|
if opt[0] == '-a':
|
||||||
AkpmOverLt = 1
|
AkpmOverLt = 1
|
||||||
@@ -106,6 +107,8 @@ def ParseOpts ():
|
|||||||
print "open output file " + opt[1] + "\n"
|
print "open output file " + opt[1] + "\n"
|
||||||
elif opt [0] == '-w':
|
elif opt [0] == '-w':
|
||||||
Aggregate = 'week'
|
Aggregate = 'week'
|
||||||
|
elif opt [0] == '-y':
|
||||||
|
Aggregate = 'year'
|
||||||
elif opt[0] == '-z':
|
elif opt[0] == '-z':
|
||||||
DumpDB = 1
|
DumpDB = 1
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user