# On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: gitdm # diff --git a/gitdm b/gitdm index 1c3adc7..883ec50 100755 --- a/gitdm +++ b/gitdm @@ -28,6 +28,7 @@ ListCount = 999999 MapUnknown = 0 DevReports = 1 DateStats = 0 +PrintMonthOnly = 0 AuthorSOBs = 1 FileFilter = None CSVFile = None @@ -43,6 +44,7 @@ CFName = 'gitdm.config' # -D Output date statistics # -h hfile HTML output to hfile # -l count Maximum length for output lists +# -M Output monthly summarized date statistics (requires -D) # -o file File for text output # -r pattern Restrict to files matching pattern # -s Ignore author SOB lines @@ -53,9 +55,9 @@ CFName = 'gitdm.config' def ParseOpts (): global Outfile, ListCount, MapUnknown, HTMLfile, DevReports global DateStats, AuthorSOBs, FileFilter, AkpmOverLt, DumpDB - global CFName, CSVFile + global CFName, CSVFile, PrintMonthOnly - opts, rest = getopt.getopt (sys.argv[1:], 'adc:Dh:l:o:r:sux:z') + opts, rest = getopt.getopt (sys.argv[1:], 'adc:Dh:l:Mo:r:sux:z') for opt in opts: if opt[0] == '-a': AkpmOverLt = 1 @@ -69,6 +71,8 @@ def ParseOpts (): HTMLfile = open (opt[1], 'w') elif opt[0] == '-l': ListCount = int (opt[1]) + elif opt[0] == '-M': + PrintMonthOnly = 1 elif opt[0] == '-o': Outfile = open (opt[1], 'w') elif opt[0] == '-r': @@ -117,11 +121,22 @@ def PrintDateStats(): dates = DateMap.keys () dates.sort () total = 0 + month_total = 0 datef = open ('datelc', 'w') + last_date = dates[0] for date in dates: total += DateMap[date] - datef.write ('%d/%02d/%02d %6d %7d\n' % (date.year, date.month, date.day, - DateMap[date], total)) + if PrintMonthOnly: + if date.year == last_date.year and date.month == last_date.month: + month_total += DateMap[date] + else: + datef.write ('%d/%02d %6d %7d\n' % (date.year, date.month, + month_total, total)) + month_total = 0 + else: + datef.write ('%d/%02d/%02d %6d %7d\n' % (date.year, date.month, + date.day, DateMap[date], total)) + last_date = date # # The core hack for grabbing the information about a changeset.