aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/get_maintainer.pl871
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 @@
13use strict; 13use strict;
14 14
15my $P = $0; 15my $P = $0;
16my $V = '0.25'; 16my $V = '0.26-beta3';
17 17
18use Getopt::Long qw(:config no_auto_abbrev); 18use Getopt::Long qw(:config no_auto_abbrev);
19 19
@@ -27,6 +27,7 @@ my $email_git_penguin_chiefs = 0;
27my $email_git = 0; 27my $email_git = 0;
28my $email_git_all_signature_types = 0; 28my $email_git_all_signature_types = 0;
29my $email_git_blame = 0; 29my $email_git_blame = 0;
30my $email_git_blame_signatures = 1;
30my $email_git_fallback = 1; 31my $email_git_fallback = 1;
31my $email_git_min_signatures = 1; 32my $email_git_min_signatures = 1;
32my $email_git_max_maintainers = 5; 33my $email_git_max_maintainers = 5;
@@ -51,9 +52,12 @@ my $pattern_depth = 0;
51my $version = 0; 52my $version = 0;
52my $help = 0; 53my $help = 0;
53 54
55my $vcs_used = 0;
56
54my $exit = 0; 57my $exit = 0;
55 58
56my %shortlog_buffer; 59my %commit_author_hash;
60my %commit_signer_hash;
57 61
58my @penguin_chief = (); 62my @penguin_chief = ();
59push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org"); 63push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org");
@@ -77,7 +81,6 @@ my @signature_tags = ();
77push(@signature_tags, "Signed-off-by:"); 81push(@signature_tags, "Signed-off-by:");
78push(@signature_tags, "Reviewed-by:"); 82push(@signature_tags, "Reviewed-by:");
79push(@signature_tags, "Acked-by:"); 83push(@signature_tags, "Acked-by:");
80my $signaturePattern = "\(" . join("|", @signature_tags) . "\)";
81 84
82# rfc822 email address - preloaded methods go here. 85# rfc822 email address - preloaded methods go here.
83my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; 86my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])";
@@ -90,29 +93,62 @@ my %VCS_cmds;
90my %VCS_cmds_git = ( 93my %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
103my %VCS_cmds_hg = ( 127my %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
118my $conf = which_conf(".get_maintainer.conf"); 154my $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
196if ($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
200if ($output_rolestats) {
201 $output_roles = 1;
202}
203 236
204if ($sections) { 237if ($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
230if ($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
238my @typevalue = (); 265my @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
401my %email_hash_name;
402my %email_hash_address;
374my @email_to = (); 403my @email_to = ();
404my %hash_list_to;
375my @list_to = (); 405my @list_to = ();
376my @scm = (); 406my @scm = ();
377my @web = (); 407my @web = ();
378my @subsystem = (); 408my @subsystem = ();
379my @status = (); 409my @status = ();
410my $signature_pattern;
380 411
381# Find responsible parties 412my @to = get_maintainer();
382 413
383foreach my $file (@files) { 414@to = merge_email(@to);
384 415