diff options
author | Aidan Skinner <aidan@skinner.me.uk> | 2011-09-30 13:14:26 +0100 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2012-02-12 11:46:30 -0700 |
commit | 65cd32216f94c8e77a5169376843d54a4cd34818 (patch) | |
tree | 57166e5b319d15affcdee16f4a97cab849420766 | |
parent | 5f6452b1d0d964c2c662f406860ed2c3c45bbb08 (diff) |
Add -y option to aggregate changes by year, not month
-rw-r--r-- | csvdump.py | 5 | ||||
-rwxr-xr-x | gitdm | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -19,9 +19,12 @@ class CSVStat: PeriodCommitHash = { } def AccumulatePatch (p, Aggregate): - date = "%.2d-%.2d-01"%(p.date.year, p.date.month) if (Aggregate == 'week'): 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) if authdatekey not in PeriodCommitHash: empl = p.author.emailemployer (p.email, p.date) @@ -62,6 +62,7 @@ ReportByFileType = 0 # -u Map unknown employers to '(Unknown)' # -x file.csv Export raw statistics as CSV # -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 def ParseOpts (): @@ -70,7 +71,7 @@ def ParseOpts (): global CFName, CSVFile, CSVPrefix,DirName, Aggregate, Numstat 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: if opt[0] == '-a': AkpmOverLt = 1 @@ -106,6 +107,8 @@ def ParseOpts (): print "open output file " + opt[1] + "\n" elif opt [0] == '-w': Aggregate = 'week' + elif opt [0] == '-y': + Aggregate = 'year' elif opt[0] == '-z': DumpDB = 1 |