diff options
| -rwxr-xr-x | scripts/get_maintainer.pl | 871 |
1 files changed, 596 insertions, 275 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 1ae8c50f1908..f51176039ff5 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | use strict; | 13 | use strict; |
| 14 | 14 | ||
| 15 | my $P = $0; | 15 | my $P = $0; |
| 16 | my $V = '0.25'; | 16 | my $V = '0.26-beta3'; |
| 17 | 17 | ||
| 18 | use Getopt::Long qw(:config no_auto_abbrev); | 18 | use Getopt::Long qw(:config no_auto_abbrev); |
| 19 | 19 | ||
| @@ -27,6 +27,7 @@ my $email_git_penguin_chiefs = 0; | |||
| 27 | my $email_git = 0; | 27 | my $email_git = 0; |
| 28 | my $email_git_all_signature_types = 0; | 28 | my $email_git_all_signature_types = 0; |
| 29 | my $email_git_blame = 0; | 29 | my $email_git_blame = 0; |
| 30 | my $email_git_blame_signatures = 1; | ||
| 30 | my $email_git_fallback = 1; | 31 | my $email_git_fallback = 1; |
| 31 | my $email_git_min_signatures = 1; | 32 | my $email_git_min_signatures = 1; |
| 32 | my $email_git_max_maintainers = 5; | 33 | my $email_git_max_maintainers = 5; |
| @@ -51,9 +52,12 @@ my $pattern_depth = 0; | |||
| 51 | my $version = 0; | 52 | my $version = 0; |
| 52 | my $help = 0; | 53 | my $help = 0; |
| 53 | 54 | ||
| 55 | my $vcs_used = 0; | ||
| 56 | |||
| 54 | my $exit = 0; | 57 | my $exit = 0; |
| 55 | 58 | ||
| 56 | my %shortlog_buffer; | 59 | my %commit_author_hash; |
| 60 | my %commit_signer_hash; | ||
| 57 | 61 | ||
| 58 | my @penguin_chief = (); | 62 | my @penguin_chief = (); |
| 59 | push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org"); | 63 | push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org"); |
| @@ -77,7 +81,6 @@ my @signature_tags = (); | |||
| 77 | push(@signature_tags, "Signed-off-by:"); | 81 | push(@signature_tags, "Signed-off-by:"); |
| 78 | push(@signature_tags, "Reviewed-by:"); | 82 | push(@signature_tags, "Reviewed-by:"); |
| 79 | push(@signature_tags, "Acked-by:"); | 83 | push(@signature_tags, "Acked-by:"); |
| 80 | my $signaturePattern = "\(" . join("|", @signature_tags) . "\)"; | ||
| 81 | 84 | ||
| 82 | # rfc822 email address - preloaded methods go here. | 85 | # rfc822 email address - preloaded methods go here. |
| 83 | my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; | 86 | my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; |
| @@ -90,29 +93,62 @@ my %VCS_cmds; | |||
| 90 | my %VCS_cmds_git = ( | 93 | my %VCS_cmds_git = ( |
| 91 | "execute_cmd" => \&git_execute_cmd, | 94 | "execute_cmd" => \&git_execute_cmd, |
| 92 | "available" => '(which("git") ne "") && (-d ".git")', | 95 | "available" => '(which("git") ne "") && (-d ".git")', |
| 93 | "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file", | 96 | "find_signers_cmd" => |
| 94 | "find_commit_signers_cmd" => "git log --no-color -1 \$commit", | 97 | "git log --no-color --since=\$email_git_since " . |
| 95 | "find_commit_author_cmd" => "git log -1 --format=\"%an <%ae>\" \$commit", | 98 | '--format="GitCommit: %H%n' . |
| 99 | 'GitAuthor: %an <%ae>%n' . | ||
| 100 | 'GitDate: %aD%n' . | ||
| 101 | 'GitSubject: %s%n' . | ||
| 102 | '%b%n"' . | ||
| 103 | " -- \$file", | ||
| 104 | "find_commit_signers_cmd" => | ||
| 105 | "git log --no-color " . | ||
| 106 | '--format="GitCommit: %H%n' . | ||
| 107 | 'GitAuthor: %an <%ae>%n' . | ||
| 108 | 'GitDate: %aD%n' . | ||
| 109 | 'GitSubject: %s%n' . | ||
| 110 | '%b%n"' . | ||
| 111 | " -1 \$commit", | ||
| 112 | "find_commit_author_cmd" => | ||
| 113 | "git log --no-color " . | ||
| 114 | '--format="GitCommit: %H%n' . | ||
| 115 | 'GitAuthor: %an <%ae>%n' . | ||
| 116 | 'GitDate: %aD%n' . | ||
| 117 | 'GitSubject: %s%n"' . | ||
| 118 | " -1 \$commit", | ||
| 96 | "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", | 119 | "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", |
| 97 | "blame_file_cmd" => "git blame -l \$file", | 120 | "blame_file_cmd" => "git blame -l \$file", |
| 98 | "commit_pattern" => "^commit [0-9a-f]{40,40}", | 121 | "commit_pattern" => "^GitCommit: ([0-9a-f]{40,40})", |
| 99 | "blame_commit_pattern" => "^([0-9a-f]+) ", | 122 | "blame_commit_pattern" => "^([0-9a-f]+) ", |
| 100 | "shortlog_cmd" => "git log --no-color --oneline --since=\$email_git_since --author=\"\$email\" -- \$file" | 123 | "author_pattern" => "^GitAuthor: (.*)", |
| 124 | "subject_pattern" => "^GitSubject: (.*)", | ||
| 101 | ); | 125 | ); |
| 102 | 126 | ||
| 103 | my %VCS_cmds_hg = ( | 127 | my %VCS_cmds_hg = ( |
| 104 | "execute_cmd" => \&hg_execute_cmd, | 128 | "execute_cmd" => \&hg_execute_cmd, |
| 105 | "available" => '(which("hg") ne "") && (-d ".hg")', | 129 | "available" => '(which("hg") ne "") && (-d ".hg")', |
| 106 | "find_signers_cmd" => | 130 | "find_signers_cmd" => |
| 107 | "hg log --date=\$email_hg_since" . | 131 | "hg log --date=\$email_hg_since " . |
| 108 | " --template='commit {node}\\n{desc}\\n' -- \$file", | 132 | "--template='HgCommit: {node}\\n" . |
| 109 | "find_commit_signers_cmd" => "hg log --template='{desc}\\n' -r \$commit", | 133 | "HgAuthor: {author}\\n" . |
| 110 | "find_commit_author_cmd" => "hg log -l 1 --template='{author}\\n' -r \$commit", | 134 | "HgSubject: {desc}\\n'" . |
| 135 | " -- \$file", | ||
| 136 | "find_commit_signers_cmd" => | ||
| 137 | "hg log " . | ||
| 138 | "--template='HgSubject: {desc}\\n'" . | ||
| 139 | " -r \$commit", | ||
| 140 | "find_commit_author_cmd" => | ||
| 141 | "hg log " . | ||
| 142 | "--template='HgCommit: {node}\\n" . | ||
| 143 | "HgAuthor: {author}\\n" . | ||
| 144 | "HgSubject: {desc|firstline}\\n'" . | ||
| 145 | " -r \$commit", | ||
| 111 | "blame_range_cmd" => "", # not supported | 146 | "blame_range_cmd" => "", # not supported |
| 112 | "blame_file_cmd" => "hg blame -c \$file", | 147 | "blame_file_cmd" => "hg blame -n \$file", |
| 113 | "commit_pattern" => "^commit [0-9a-f]{40,40}", | 148 | "commit_pattern" => "^HgCommit: ([0-9a-f]{40,40})", |
| 114 | "blame_commit_pattern" => "^([0-9a-f]+):", | 149 | "blame_commit_pattern" => "^([ 0-9a-f]+):", |
| 115 | "shortlog_cmd" => "ht log --date=\$email_hg_since" | 150 | "author_pattern" => "^HgAuthor: (.*)", |
| 151 | "subject_pattern" => "^HgSubject: (.*)", | ||
| 116 | ); | 152 | ); |
| 117 | 153 | ||
| 118 | my $conf = which_conf(".get_maintainer.conf"); | 154 | my $conf = which_conf(".get_maintainer.conf"); |
| @@ -146,6 +182,7 @@ if (!GetOptions( | |||
| 146 | 'git!' => \$email_git, | 182 | 'git!' => \$email_git, |
| 147 | 'git-all-signature-types!' => \$email_git_all_signature_types, | 183 | 'git-all-signature-types!' => \$email_git_all_signature_types, |
| 148 | 'git-blame!' => \$email_git_blame, | 184 | 'git-blame!' => \$email_git_blame, |
| 185 | 'git-blame-signatures!' => \$email_git_blame_signatures, | ||
| 149 | 'git-fallback!' => \$email_git_fallback, | 186 | 'git-fallback!' => \$email_git_fallback, |
| 150 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, | 187 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, |
| 151 | 'git-min-signatures=i' => \$email_git_min_signatures, | 188 | 'git-min-signatures=i' => \$email_git_min_signatures, |
| @@ -193,13 +230,9 @@ if (-t STDIN && !@ARGV) { | |||
| 193 | die "$P: missing patchfile or -f file - use --help if necessary\n"; | 230 | die "$P: missing patchfile or -f file - use --help if necessary\n"; |
| 194 | } | 231 | } |
| 195 | 232 | ||
| 196 | if ($output_separator ne ", ") { | 233 | $output_multiline = 0 if ($output_separator ne ", "); |
| 197 | $output_multiline = 0; | 234 | $output_rolestats = 1 if ($interactive); |
| 198 | } | 235 | $output_roles = 1 if ($output_rolestats); |
| 199 | |||
| 200 | if ($output_rolestats) { | ||
| 201 | $output_roles = 1; | ||
| 202 | } | ||
| 203 | 236 | ||
| 204 | if ($sections) { | 237 | if ($sections) { |
| 205 | $email = 0; | 238 | $email = 0; |
| @@ -227,12 +260,6 @@ if (!top_of_kernel_tree($lk_path)) { | |||
| 227 | . "a linux kernel source tree.\n"; | 260 | . "a linux kernel source tree.\n"; |
| 228 | } | 261 | } |
| 229 | 262 | ||
| 230 | if ($email_git_all_signature_types) { | ||
| 231 | $signaturePattern = "(.+?)[Bb][Yy]:"; | ||
| 232 | } | ||
| 233 | |||
| 234 | |||
| 235 | |||
| 236 | ## Read MAINTAINERS for type/value pairs | 263 | ## Read MAINTAINERS for type/value pairs |
| 237 | 264 | ||
| 238 | my @typevalue = (); | 265 | my @typevalue = (); |
| @@ -371,168 +398,193 @@ foreach my $file (@ARGV) { | |||
| 371 | 398 | ||
| 372 | @file_emails = uniq(@file_emails); | 399 | @file_emails = uniq(@file_emails); |
| 373 | 400 | ||
| 401 | my %email_hash_name; | ||
| 402 | my %email_hash_address; | ||
| 374 | my @email_to = (); | 403 | my @email_to = (); |
| 404 | my %hash_list_to; | ||
| 375 | my @list_to = (); | 405 | my @list_to = (); |
| 376 | my @scm = (); | 406 | my @scm = (); |
| 377 | my @web = (); | 407 | my @web = (); |
| 378 | my @subsystem = (); | 408 | my @subsystem = (); |
| 379 | my @status = (); | 409 | my @status = (); |
| 410 | my $signature_pattern; | ||
| 380 | 411 | ||
| 381 | # Find responsible parties | 412 | my @to = get_maintainer(); |
| 382 | 413 | ||
| 383 | foreach my $file (@files) { | 414 | @to = merge_email(@to); |
| 384 | 415 | ||
