linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: florian@mickler.org
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Florian Mickler <florian@mickler.org>,
	"Andrew Morton (role:commit_signer)" <akpm@linux-foundation.org>,
	"Joe Perches (role:commit_signer)" <joe@perches.com>,
	"Stephen Hemminger (role:commit_signer)" <shemminger@vyatta.com>,
	"Wolfram Sang (role:commit_signer)" <w.sang@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] get_maintainer.pl: append reason for cc to the name by default
Date: Fri, 10 Sep 2010 11:33:31 +0200	[thread overview]
Message-ID: <1284111212-10659-1-git-send-email-florian@mickler.org> (raw)

The script get_maintainer.pl is a very useful tool for deploying changes
made to the kernel. Among others it searches not only the MAINTAINERS
file but also the git history for people to send patches to.

This can be unexpected for the receiving side and can and does provoke
sometimes anger because it is not easy to determine if the sender did
explicitly put the receiving side on the cc list, or if they just
trolled the tree. The receiving side, if not used to be cc'd on many
things will check the patch, spend time investigating what the heck they
were cc'd just to realize, that there was no special reason.

As get_maintainer.pl is frequently used by kernel newcommers who _can_
not know whom to cc by themself, this anger then comes as a surprise for them
and definitely puts them in an awkward position.

By appending a  a note of the reason for the cc in the name, the reason
becomes clear and the receiving side is relieved from feeling obliged to
check the patch  while the sending side has a chance to adapt the
cc'list to their liking.

But the most useful aspect of this is, IMHO, that it makes it transparent who
just used get_maintainer.pl as a shortcut to increase his own
patch-throughput or who really put an effort in finding or editing the
cc'list to their likings.

Signed-off-by: Florian Mickler <florian@mickler.org>
---
 scripts/get_maintainer.pl |   77 ++++++++++++++++++++++++--------------------
 1 files changed, 42 insertions(+), 35 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index b228198..0cdc66a 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -255,6 +255,9 @@ close($maint);
 
 my %mailmap;
 
+#
+# read in a name->address lookup table
+#
 if ($email_remove_duplicates) {
     open(my $mailmap, '<', "${lk_path}.mailmap")
 	or warn "$P: Can't open .mailmap: $!\n";
@@ -265,10 +268,11 @@ if ($email_remove_duplicates) {
 	next if ($line =~ m/^\s*$/);
 
 	my ($name, $address) = parse_email($line);
-	$line = format_email($name, $address, $email_usename);
+	$line = format_email($name, $address, "", $email_usename);
 
 	next if ($line =~ m/^\s*$/);
 
+	#append address to name 
 	if (exists($mailmap{$name})) {
 	    my $obj = $mailmap{$name};
 	    push(@$obj, $address);
@@ -457,11 +461,11 @@ if ($email) {
     foreach my $chief (@penguin_chief) {
 	if ($chief =~ m/^(.*):(.*)/) {
 	    my $email_address;
-
-	    $email_address = format_email($1, $2, $email_usename);
+	    $email_address = format_email($1, $2, 'chief penguin', $email_usename);
 	    if ($email_git_penguin_chiefs) {
 		push(@email_to, [$email_address, 'chief penguin']);
 	    } else {
+		$email_address = format_email($1, $2, "", 0);
 		@email_to = grep($_->[0] !~ /${email_address}/, @email_to);
 	    }
 	}
@@ -469,10 +473,9 @@ if ($email) {
 
     foreach my $email (@file_emails) {
 	my ($name, $address) = parse_email($email);
-
-	my $tmp_email = format_email($name, $address, $email_usename);
-	push_email_address($tmp_email, '');
-	add_role($tmp_email, 'in file');
+	my $tmp_email = format_email($name, $address, "", $email_usename);
+	push_email_address($tmp_email, 'explicit cc', 'in file');
+	add_role($tmp_email, 'explicit cc', 'in file');
     }
 }
 
@@ -660,10 +663,13 @@ sub parse_email {
 }
 
 sub format_email {
-    my ($name, $address, $usename) = @_;
-
+    my ($name, $address, $simple_role, $usename) = @_;
     my $formatted_email;
 
+    my $role_display = "";
+    if($simple_role){
+    	$role_display = "(role:$simple_role) ";
+    }
     $name =~ s/^\s+|\s+$//g;
     $name =~ s/^\"|\"$//g;
     $address =~ s/^\s+|\s+$//g;
@@ -675,9 +681,9 @@ sub format_email {
 
     if ($usename) {
 	if ("$name" eq "") {
-	    $formatted_email = "$address";
+	    $formatted_email = "$role_display<$address>";
 	} else {
-	    $formatted_email = "$name <$address>";
+	    $formatted_email = "$name $role_display<$address>";
 	}
     } else {
 	$formatted_email = $address;
@@ -769,7 +775,7 @@ sub get_maintainer_role {
 	$role = "chief penguin";
     }
 
-    return $role . ":" . $subsystem;
+    return ($role, $role . ":" . $subsystem);
 }
 
 sub get_list_role {
@@ -836,14 +842,14 @@ sub add_categories {
 			if ($tv =~ m/^(\C):\s*(.*)/) {
 			    if ($1 eq "P") {
 				$name = $2;
-				$pvalue = format_email($name, $address, $email_usename);
+				$pvalue = format_email($name, $address, "maintainer", $email_usename);
 			    }
 			}
 		    }
 		}
 		if ($email_maintainer) {
-		    my $role = get_maintainer_role($i);
-		    push_email_addresses($pvalue, $role);
+		    my ($role, $debug_role) = get_maintainer_role($i);
+		    push_email_addresses($pvalue, $role, $debug_role);
 		}
 	    } elsif ($ptype eq "T") {
 		push(@scm, $pvalue);
@@ -870,7 +876,7 @@ sub email_inuse {
 }
 
 sub push_email_address {
-    my ($line, $role) = @_;
+    my ($line, $display_role, $debug_role) = @_;
 
     my ($name, $address) = parse_email($line);
 
@@ -879,9 +885,9 @@ sub push_email_address {
     }
 
     if (!$email_remove_duplicates) {
-	push(@email_to, [format_email($name, $address, $email_usename), $role]);
+	push(@email_to, [format_email($name, $address, $display_role, $email_usename), $debug_role]);
     } elsif (!email_inuse($name, $address)) {
-	push(@email_to, [format_email($name, $address, $email_usename), $role]);
+	push(@email_to, [format_email($name, $address, $display_role, $email_usename), $debug_role]);
 	$email_hash_name{$name}++;
 	$email_hash_address{$address}++;
     }
@@ -890,29 +896,29 @@ sub push_email_address {
 }
 
 sub push_email_addresses {
-    my ($address, $role) = @_;
+    my ($address, $display_role, $debug_role) = @_;
 
     my @address_list = ();
 
     if (rfc822_valid($address)) {
-	push_email_address($address, $role);
+	push_email_address($address, $display_role, $debug_role);
     } elsif (@address_list = rfc822_validlist($address)) {
 	my $array_count = shift(@address_list);
 	while (my $entry = shift(@address_list)) {
-	    push_email_address($entry, $role);
+	    push_email_address($entry, $display_role, $debug_role);
 	}
     } else {
-	if (!push_email_address($address, $role)) {
+	if (!push_email_address($address, $display_role, $debug_role)) {
 	    warn("Invalid MAINTAINERS address: '" . $address . "'\n");
 	}
     }
 }
 
 sub add_role {
-    my ($line, $role) = @_;
+    my ($line, $display_role, $role) = @_;
 
     my ($name, $address) = parse_email($line);
-    my $email = format_email($name, $address, $email_usename);
+    my $email = format_email($name, $address, $display_role, $email_usename);
 
     foreach my $entry (@email_to) {
 	if ($email_remove_duplicates) {
@@ -920,6 +926,7 @@ sub add_role {
 	    if (($name eq $entry_name || $address eq $entry_address)
 		&& ($role eq "" || !($entry->[1] =~ m/$role/))
 	    ) {
+		#append role
 		if ($entry->[1] eq "") {
 		    $entry->[1] = "$role";
 		} else {
@@ -930,6 +937,7 @@ sub add_role {
 	    if ($email eq $entry->[0]
 		&& ($role eq "" || !($entry->[1] =~ m/$role/))
 	    ) {
+		#append role
 		if ($entry->[1] eq "") {
 		    $entry->[1] = "$role";
 		} else {
@@ -958,18 +966,20 @@ sub mailmap {
 
     foreach my $line (@lines) {
 	my ($name, $address) = parse_email($line);
+
 	if (!exists($hash{$name})) {
 	    $hash{$name} = $address;
 	} elsif ($address ne $hash{$name}) {
 	    $address = $hash{$name};
-	    $line = format_email($name, $address, $email_usename);
+	    $line = format_email($name, $address, "", $email_usename);
 	}
+	
 	if (exists($mailmap{$name})) {
 	    my $obj = $mailmap{$name};
 	    foreach my $map_address (@$obj) {
 		if (($map_address eq $address) &&
 		    ($map_address ne $hash{$name})) {
-		    $line = format_email($name, $hash{$name}, $email_usename);
+		    $line = format_email($name, $hash{$name}, "", $email_usename);
 		}
 	    }
 	}
@@ -1021,7 +1031,7 @@ sub vcs_find_signers {
 
     foreach my $line (@lines) {
 	my ($name, $address) = parse_email($line);
-	$line = format_email($name, $address, 1);
+	$line = format_email($name, $address, "", 1);
     }
 
     return ($commits, @lines);
@@ -1136,13 +1146,10 @@ sub vcs_assign {
 	last if ($sign_offs < $email_git_min_signatures ||
 		 $count > $email_git_max_maintainers ||
 		 $percent < $email_git_min_percent);
-	push_email_address($line, '');
-	if ($output_rolestats) {
-	    my $fmt_percent = sprintf("%.0f", $percent);
-	    add_role($line, "$role:$sign_offs/$divisor=$fmt_percent%");
-	} else {
-	    add_role($line, $role);
-	}
+	my $fmt_percent = sprintf("%.0f", $percent);
+	my $debug_role = "$role:$sign_offs/$divisor=$fmt_percent%";
+	push_email_address($line, $role, $debug_role);
+	add_role($line, $role, $debug_role);
     }
 }
 
@@ -1248,7 +1255,7 @@ sub clean_file_emails {
 	    $name = '"' . substr($name, 2, length($name) - 2);
 	}
 
-	my $fmt_email = format_email($name, $address, $email_usename);
+	my $fmt_email = format_email($name, $address, "", $email_usename);
 	push(@fmt_emails, $fmt_email);
     }
     return @fmt_emails;
-- 
1.7.2


             reply	other threads:[~2010-09-10  9:34 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10  9:33 florian [this message]
2010-09-10  9:42 ` [PATCH] get_maintainer.pl: append reason for cc to the name by default Joe Perches
2010-09-10  9:46   ` Wolfram Sang
2010-09-10  9:53   ` Mark Brown
2010-09-10 10:04     ` Joe Perches
2010-09-10 10:18       ` Mark Brown
2010-09-10 10:47         ` Joe Perches
2010-09-10 11:07           ` Mark Brown
2010-09-11  0:22           ` [PATCH] scripts/get_maintainer.pl: Add --git-blame --rolestats "Authored lines" information Joe Perches
2010-09-11  9:38             ` Florian Mickler
2010-09-11  9:52               ` Joe Perches
2010-09-11 10:02                 ` Florian Mickler
2010-09-11 10:22                   ` Joe Perches
2010-09-11 19:22                   ` [PATCH] Documentation/SubmittingPatches: Add and describe scripts/get_maintainer.pl Joe Perches
2010-09-11 19:34                     ` Florian Mickler
2010-09-11 19:43                     ` [PATCH V2] " Joe Perches
2010-09-12 16:18                       ` Florian Mickler
2010-09-10 11:44         ` [PATCH] get_maintainer.pl: append reason for cc to the name by default Alan Cox
2010-09-10 10:22       ` Florian Mickler
2010-09-10 10:47         ` Joe Perches
2010-09-11 21:22     ` Joe Perches
2010-09-10 10:30   ` Florian Mickler
2010-09-10 11:04     ` Mark Brown
2010-09-10 11:15       ` Florian Mickler
2010-09-10 21:04     ` Andrew Morton
2010-09-10 21:39       ` Florian Mickler
2010-09-10 21:44       ` Joe Perches
2010-09-13  4:01     ` Valdis.Kletnieks
2010-09-13  5:21       ` [PATCH] get_maintainer.pl: Look for .get_maintainer.conf in lk, then $HOME then scripts Joe Perches
2010-09-13  6:13         ` Florian Mickler
2010-09-13 13:21         ` Valdis.Kletnieks
2010-09-10 11:11   ` [PATCH] get_maintainer.pl: append reason for cc to the name by default Florian Mickler
2010-09-10 15:12     ` Joe Perches
2010-09-11  9:34       ` Florian Mickler
2010-09-11  0:13   ` Christoph Hellwig
2010-09-11  0:31     ` Joe Perches
2010-09-11  0:45       ` Christoph Hellwig
2010-09-11  0:56         ` Joe Perches
2010-09-11  9:28         ` Florian Mickler
2010-09-13  7:16           ` Eric W. Biederman
2010-09-13  7:57             ` Joe Perches
2010-09-13  8:54               ` Florian Mickler
2010-09-14 17:19                 ` Eric W. Biederman
2010-09-14 17:46                   ` Florian Mickler
2010-09-15  3:28                     ` Joe Perches
2010-09-15  4:34                       ` Florian Mickler
2010-09-15  4:45                         ` Joe Perches
2010-09-15 12:49                           ` Florian Mickler
2010-09-14 23:15                   ` Joe Perches
2010-09-13  9:01             ` Florian Mickler
2010-09-14 17:24               ` Eric W. Biederman
2010-09-26 18:52 ` RFC: " Joe Perches
2010-09-27 14:57   ` Florian Mickler
2010-09-27 15:44     ` Ted Ts'o
2010-09-27 17:00       ` Florian Mickler
2010-09-27 18:21         ` Ted Ts'o
2010-09-27 19:26           ` Florian Mickler
2010-09-27 20:08             ` Joe Perches
2010-09-27 20:47               ` Ted Ts'o
2010-09-27 21:16                 ` Joe Perches
2010-09-28  4:22                   ` Ted Ts'o
2010-09-28  4:37                   ` Mark Brown

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=1284111212-10659-1-git-send-email-florian@mickler.org \
    --to=florian@mickler.org \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=w.sang@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).