From: Ben Hutchings <ben@decadent.org.uk>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] scripts/get_maintainer.pl: add role output option
Date: Thu, 15 Oct 2009 04:51:26 +0100 [thread overview]
Message-ID: <1255578686.2488.228.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 4918 bytes --]
Add the output option '--roles' to get_maintainer.pl. This causes it
to show the role of each email address, i.e. why it was selected.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
scripts/get_maintainer.pl | 52 ++++++++++++++++++++++++++++++++-------------
1 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index cdb44b6..591fd3d 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -33,6 +33,7 @@ my $email_git_blame = 0;
my $email_remove_duplicates = 1;
my $output_multiline = 1;
my $output_separator = ", ";
+my $output_roles = 0;
my $scm = 0;
my $web = 0;
my $subsystem = 0;
@@ -78,6 +79,7 @@ if (!GetOptions(
'l!' => \$email_list,
's!' => \$email_subscriber_list,
'multiline!' => \$output_multiline,
+ 'roles!' => \$output_roles,
'separator=s' => \$output_separator,
'subsystem!' => \$subsystem,
'status!' => \$status,
@@ -293,9 +295,9 @@ if ($email) {
$email_address = format_email($1, $2);
if ($email_git_penguin_chiefs) {
- push(@email_to, $email_address);
+ push(@email_to, [$email_address, 'chief penguin']);
} else {
- @email_to = grep(!/${email_address}/, @email_to);
+ @email_to = grep($_->[0] !~ /${email_address}/, @email_to);
}
}
}
@@ -309,7 +311,7 @@ if ($email || $email_list) {
if ($email_list) {
@to = (@to, @list_to);
}
- output(uniq(@to));
+ output(merge_email(@to));
}
if ($scm) {
@@ -381,6 +383,7 @@ Output type options:
--separator [, ] => separator for multiple entries on 1 line
using --separator also sets --nomultiline if --separator is not [, ]
--multiline => print 1 entry per line
+ --roles => show roles
Other options:
--pattern-depth => Number of pattern directory traversals (default: 0 (all))
@@ -537,11 +540,11 @@ sub add_categories {
}
if ($list_additional =~ m/subscribers-only/) {
if ($email_subscriber_list) {
- push(@list_to, $list_address);
+ push(@list_to, [$list_address, 'subscriber list']);
}
} else {
if ($email_list) {
- push(@list_to, $list_address);
+ push(@list_to, [$list_address, 'open list']);
}
}
} elsif ($ptype eq "M") {
@@ -558,7 +561,7 @@ sub add_categories {
}
}
if ($email_maintainer) {
- push_email_addresses($pvalue);
+ push_email_addresses($pvalue, 'maintainer');
}
} elsif ($ptype eq "T") {
push(@scm, $pvalue);
@@ -585,7 +588,7 @@ sub email_inuse {
}
sub push_email_address {
- my ($line) = @_;
+ my ($line, $role) = @_;
my ($name, $address) = parse_email($line);
@@ -594,9 +597,9 @@ sub push_email_address {
}
if (!$email_remove_duplicates) {
- push(@email_to, format_email($name, $address));
+ push(@email_to, [format_email($name, $address), $role]);
} elsif (!email_inuse($name, $address)) {
- push(@email_to, format_email($name, $address));
+ push(@email_to, [format_email($name, $address), $role]);
$email_hash_name{$name}++;
$email_hash_address{$address}++;
}
@@ -605,19 +608,19 @@ sub push_email_address {
}
sub push_email_addresses {
- my ($address) = @_;
+ my ($address, $role) = @_;
my @address_list = ();
if (rfc822_valid($address)) {
- push_email_address($address);
+ push_email_address($address, $role);
} elsif (@address_list = rfc822_validlist($address)) {
my $array_count = shift(@address_list);
while (my $entry = shift(@address_list)) {
- push_email_address($entry);
+ push_email_address($entry, $role);
}
} else {
- if (!push_email_address($address)) {
+ if (!push_email_address($address, $role)) {
warn("Invalid MAINTAINERS address: '" . $address . "'\n");
}
}
@@ -714,7 +717,7 @@ sub recent_git_signoffs {
last if ($sign_offs < $email_git_min_signatures ||
$count > $email_git_max_maintainers ||
$sign_offs * 100 / $total_sign_offs < $email_git_min_percent);
- push_email_address($line);
+ push_email_address($line, 'signed-off');
}
}
@@ -795,7 +798,7 @@ sub git_assign_blame {
last if ($sign_offs < $email_git_min_signatures ||
$count > $email_git_max_maintainers ||
$sign_offs * 100 / $total_sign_offs < $email_git_min_percent);
- push_email_address($line);
+ push_email_address($line, 'blamed');
}
}
@@ -816,6 +819,25 @@ sub sort_and_uniq {
return @parms;
}
+sub merge_email {
+ my @lines;
+ my %saw;
+
+ for (@_) {
+ my ($address, $role) = @$_;
+ if (!$saw{$address}) {
+ if ($output_roles) {
+ push @lines, "$address ($role)";
+ } else {
+ push @lines, $address;
+ }
+ $saw{$address} = 1;
+ }
+ }
+
+ return @lines;
+}
+
sub output {
my @parms = @_;
--
1.6.4.3
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2009-10-15 3:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 3:51 Ben Hutchings [this message]
2009-10-15 4:42 ` [PATCH] scripts/get_maintainer.pl: add role output option Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1255578686.2488.228.camel@localhost \
--to=ben@decadent.org.uk \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.