From 55b512087a7b5a793cc328f75636be62bc9ce7ac Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Tue, 29 Jan 2013 13:03:17 -0600 Subject: [PATCH] Deal with dates that fall off the end. --- tools/committer_count.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/committer_count.rb b/tools/committer_count.rb index ad27ad0610..0b3bf42a03 100755 --- a/tools/committer_count.rb +++ b/tools/committer_count.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# The commit_scorecard is a way to tell who's been active over the last +# The committer_count.rb is a way to tell who's been active over the last # given period. It's of course, quite coarse -- someone with 10 commits in a day # may or may not be more productive than someone with 3, but over long enough # periods, it's an okay metric to measure involvement with the project, since @@ -10,11 +10,11 @@ # code review happened, so it's still a measure of work). You can get different # stats by ignoring merge commits, once option parsing is implemented. # -# Usage: ./commit_scorecard.rb 2011-01-01 | head -10 # Since a particular date -# ./commit_scorecard.rb 1y | head -10 # Last year -# ./commit_scorecard.rb 6m | head -10 # Last six months -# ./commit_scorecard.rb 12w | head -10 # Last twelve weeks -# ./commit_scorecard.rb 100d | head -10 # Last hundred days +# Usage: ./committer_count.rb 2011-01-01 | head -10 # Since a particular date +# ./committer_count.rb 1y | head -10 # Last year +# ./committer_count.rb 6m | head -10 # Last six months +# ./committer_count.rb 12w | head -10 # Last twelve weeks +# ./committer_count.rb 100d | head -10 # Last hundred days # # # History with colors and e-mail addresses (respecting .mailmap): @@ -49,9 +49,9 @@ end date = ARGV[0] || "2005-03-22" # A day before the first SVN commit. calc_date = parse_date(date) - @history.each_line do |line| parsed_line = line.match(/^([^\s+]+)\s(.{7,})\s'(.*)'\s(.*)[\r\n]*$/) + next unless parsed_line break if calc_date == parsed_line[1] @recent_history << GitLogLine.new(*parsed_line[1,4]) end