Created
January 9, 2013 03:41
-
-
Save richo/4490351 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
totals = { | |
feature: 0, | |
maint: 0 | |
} | |
`git rev-list --no-merges 1e1690b..HEAD`.lines.each.with_index do |rev, idx| | |
rev = rev.chomp | |
added = 0 | |
removed = 0 | |
files = [] | |
`git diff #{rev}^ --numstat`.lines.each do |line| | |
next if line.start_with? "-" | |
t_added, t_removed, t_file = line.split(/\s/) | |
next if t_file.start_with? "vendor" | |
files << t_file | |
added += t_added.to_i | |
removed += t_removed.to_i | |
totals[:added] | |
end | |
if removed == 0 || added / removed < 0.1 | |
totals[:feature] += added + removed | |
else | |
totals[:maint] += added + removed | |
end | |
# puts "Added #{added} Removed #{removed} Files #{files}" | |
puts totals.inspect if idx % 100 == 0 | |
end | |
puts totals.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment