diff options
author | Florian Pritz <bluewind@xssn.at> | 2010-09-29 19:29:54 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xssn.at> | 2010-09-29 19:29:54 +0200 |
commit | 6af803f4d9df06b06c31ebc907deb106df9c1e9b (patch) | |
tree | 1914c1c7eedb37e9bf331b3b025e68f01237ad8f | |
parent | e11cba2b63aa12c8535e1003ff9731b82f6bff00 (diff) | |
download | bin-6af803f4d9df06b06c31ebc907deb106df9c1e9b.tar.gz bin-6af803f4d9df06b06c31ebc907deb106df9c1e9b.tar.xz |
add git-cc
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rwxr-xr-x | git-cc | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +@authors = {} + +def parse_blame(line) + key, value = line.split(" ", 2) + case key + when "author" + @name = value + when "author-mail" + @mail = value + author = "\"#{@name}\" #{@mail}" + @authors[author] = true + end +end + +ARGV.each do |filename| + patch_file = File.open(filename) + patch_file.each_line do |patch_line| + @from ||= patch_line[/From (\w+)/, 1] + case patch_line + when /^---\s+(\S+)/ + @source = $1[2..-1] + when /^@@\s-(\d+),(\d+)/ + blame = `git blame --incremental -L #{$1},+#{$2} #{@source} #{@from}^ | grep author` + blame.each_line { |l| parse_blame(l.chomp) } + end + end +end + +@authors.each_key do |a| + puts a +end
\ No newline at end of file |