blob: 1fb4d5c994a3c27d6df7ee4d5051b444f1e7aa64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|