public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: torvalds@linux-foundation.org, pavel@ucw.cz,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/10] MAINTAINERS - script, patterns, and misc fixes
Date: Wed, 14 Jan 2009 11:37:17 -0800	[thread overview]
Message-ID: <1231961837.30095.23.camel@localhost> (raw)
In-Reply-To: <20090113231329.ee0e534f.akpm@linux-foundation.org>

On Tue, 2009-01-13 at 23:13 -0800, Andrew Morton wrote:
> On Tue, 13 Jan 2009 20:26:50 -0800 Joe Perches <joe@perches.com> wrote:
> > get_maintainer output is in alphabetical order,
> > not ordered by signer frequency.
> The latter would be better?
> > Balbir Singh is one of the top 5 signers over the last year
> > for mm/filemap.c excluding you and Linus.
> > $ git log --since=1-year-ago mm/filemap.c | \
> > 	grep -P "^ +.*by:" | sort | uniq -c | sort -rn | head
> >      38     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> >      35     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> >      14     Signed-off-by: Nick Piggin <npiggin@suse.de>
> >       5     Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >       5     Signed-off-by: Hugh Dickins <hugh@veritas.com>
> >       4     Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
> >       4     Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> I assume there's some remove-akpm rule?  If so, can we please remove
> it?  This tool will be used for bug reports and patches - I want to see
> those emails!

Hi Andrew.

This seems to do what you want.

commit ce0155dfa768f29e09b45a818e177274ff26bf97
Author: Joe Perches <joe@perches.com>
Date:   Wed Jan 14 11:25:06 2009 -0800

    scripts/get_maintainers.pl - Output maintainers by commit frequency
    
    Do not sort the maintainers alphabetically
    
    Also add git options:
    
    git-max-maintainers - maximum # of signers to list
    git-min-signatures - minimum signatures to be considered maintainer
    git-since - git history to use
    
    Signed-off-by: Joe Perches <joe@perches.com>

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 43da676..48e2d5f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -13,7 +13,7 @@
 use strict;
 
 my $P = $0;
-my $V = '0.12';
+my $V = '0.13';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -25,6 +25,9 @@ my $email_list = 1;
 my $email_subscriber_list = 0;
 my $email_git = 1;
 my $email_git_penguin_chiefs = 0;
+my $email_git_min_signatures = 1;
+my $email_git_max_maintainers = 5;
+my $email_git_since = "1-year-ago";
 my $output_multiline = 1;
 my $output_separator = ", ";
 my $scm = 0;
@@ -37,7 +40,8 @@ my $exit = 0;
 
 my @penguin_chief = ();
 push(@penguin_chief,"Linus Torvalds:torvalds\@linux-foundation.org");
-push(@penguin_chief,"Andrew Morton:akpm\@linux-foundation.org");
+#Andrew wants in on most everything - 2009/01/14
+#push(@penguin_chief,"Andrew Morton:akpm\@linux-foundation.org");
 
 my @penguin_chief_names = ();
 foreach my $chief (@penguin_chief) {
@@ -53,6 +57,9 @@ if (!GetOptions(
 		'email!' => \$email,
 		'git!' => \$email_git,
 		'git-chief-penguins!' => \$email_git_penguin_chiefs,
+		'git-min-signatures=i' => \$email_git_min_signatures,
+		'git-max-maintainers=i' => \$email_git_max_maintainers,
+		'git-since=s' => \$email_git_since,
 		'm!' => \$email_maintainer,
 		'n!' => \$email_usename,
 		'l!' => \$email_list,
@@ -154,29 +161,11 @@ my @status = ();
 
 # Find responsible parties
 
-if ($email_git_penguin_chiefs) {
-    foreach my $chief (@penguin_chief) {
-	if ($chief =~ m/^(.*):(.*)/) {
-	    my $chief_name = $1;
-	    my $chief_addr = $2;
-	    if ($email_usename) {
-		push(@email_to, format_email($chief_name, $chief_addr));
-	    } else {
-		push(@email_to, $chief_addr);
-	    }
-	}
-    }
-}
-
 foreach my $file (@files) {
-    my $exclude = 0;
-
-    if ($email_git) {
-	recent_git_signoffs($file);
-    }
 
 #Do not match excluded file patterns
 
+    my $exclude = 0;
     foreach my $line (@typevalue) {
 	if ($line =~ m/^(\C):(.*)/) {
 	    my $type = $1;
@@ -204,6 +193,25 @@ foreach my $file (@files) {
 	    $tvi++;
 	}
     }
+
+    if ($email_git) {
+	recent_git_signoffs($file);
+    }
+
+}
+
+if ($email_git_penguin_chiefs) {
+    foreach my $chief (@penguin_chief) {
+	if ($chief =~ m/^(.*):(.*)/) {
+	    my $chief_name = $1;
+	    my $chief_addr = $2;
+	    if ($email_usename) {
+		push(@email_to, format_email($chief_name, $chief_addr));
+	    } else {
+		push(@email_to, $chief_addr);
+	    }
+	}
+    }
 }
 
 if ($email) {
@@ -211,7 +219,9 @@ if ($email) {
     if ($address_cnt == 0 && $email_list) {
 	push(@email_to, "linux-kernel\@vger.kernel.org");
     }
-    @email_to = sort_and_uniq(@email_to);
+
+#Don't sort email address list, but do remove duplicates
+    @email_to = uniq(@email_to);
     output(@email_to);
 }
 
@@ -273,6 +283,9 @@ MAINTAINER field selection options:
   --email => print email address(es) if any
     --git => include recent git \*-by: signers
     --git-chief-penguins => include ${penguin_chiefs}
+    --git-min-signatures => number of signatures required (default: 1)
+    --git-max-maintainers => maximum maintainers to add (default: 5)
+    --git-max-history => git history to use (default: 1-year-ago)
     --m => include maintainer(s) if any
     --n => include name 'Full Name <addr\@domain.tld>'
     --l => include list(s) if any
@@ -406,27 +419,36 @@ sub recent_git_signoffs {
     my $sign_offs = "";
     my $cmd = "";
     my $output = "";
-
+    my $count = 0;
     my @lines = ();
 
     if (which("git") eq "") {
 	die("$P: git not found.  Add --nogit to options?\n");
     }
 
-    $cmd = "git log --since=12.months.ago -- ${file}";
-    $cmd .= " | grep -i '^    [-a-z]*by:.*\\\@'";
+    $cmd = "git log --since=${email_git_since} -- ${file}";
+    $cmd .= " | grep -P '^    [-A-Za-z]+by:.*\\\@'";
     if (!$email_git_penguin_chiefs) {
 	$cmd .= " | grep -E -v \"${penguin_chiefs}\"";
     }
-    $cmd .= " | sort | uniq -c | sort -r -n | head -n 5";
-    $cmd .= " | cut -f 2 -d ':' -s";
+    $cmd .= " | sort | uniq -c | sort -rn";
 
     $output = `${cmd}`;
-
     $output =~ s/^\s*//gm;
 
     @lines = split("\n", $output);
     foreach my $line (@lines) {
+	if ($line =~ m/([0-9]+)\s+([-A-Za-z]+by:)\s+(.*)/) {
+	    my $sign_offs = $1;
+	    $line = $3;
+	    $count++;
+	    if ($sign_offs < $email_git_min_signatures ||
+	        $count > $email_git_max_maintainers) {
+		last;
+	    }
+	} else {
+	    die("$P: Unexpected git output: ${line}\n");
+	}
 	if ($line =~ m/(.*) <(.*)>/) {
 	    my $git_name = $1;
 	    my $git_addr = $2;
@@ -447,6 +469,14 @@ sub recent_git_signoffs {
     return $output;
 }
 
+sub uniq {
+    my @parms = @_;
+
+    my %saw;
+    @parms = grep(!$saw{$_}++, @parms);
+    return @parms;
+}
+
 sub sort_and_uniq {
     my @parms = @_;
 



  parent reply	other threads:[~2009-01-14 19:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 20:28 [PATCH 0/10] MAINTAINERS - script, patterns, and misc fixes Joe Perches
2009-01-13 20:28 ` [PATCH 01/10] Add scripts/get_maintainer.pl Joe Perches
2009-01-13 20:28 ` [PATCH 02/10] MAINTAINERS - Add file patterns Joe Perches
2009-01-13 20:28 ` [PATCH 03/10] MAINTAINERS - Standardize style Joe Perches
2009-01-13 20:28 ` [PATCH 04/10] MAINTAINERS - Remove CS4280 Joe Perches
2009-01-13 20:28 ` [PATCH 05/10] MAINTAINERS - Remove HP Fibre Channel HBA no longer in tree Joe Perches
2009-01-13 20:28 ` [PATCH 06/10] MAINTAINERS - standardize "T: git urls" Joe Perches
2009-01-13 20:28 ` [PATCH 07/10] MAINTAINERS - Add Linus Torvalds' git Joe Perches
2009-01-13 20:28 ` [PATCH 08/10] MAINTAINERS - Add FTRACE git Joe Perches
2009-01-14  5:59   ` Paul Mundt
2009-01-14  6:19     ` Joe Perches
2009-01-14 13:16       ` Steven Rostedt
2009-01-14 13:35         ` Frédéric Weisbecker
2009-01-14 22:37         ` Ingo Molnar
2009-01-13 20:28 ` [PATCH 09/10] MAINTAINERS - i2c_tiny_usb T: should be W: Joe Perches
2009-01-13 20:28 ` [PATCH 10/10] MAINTAINERS - Update FPU Emulator contact address and web page Joe Perches
2009-01-13 20:54 ` [PATCH 0/10] MAINTAINERS - script, patterns, and misc fixes Andrew Morton
2009-01-14  3:49   ` Joe Perches
2009-01-14  4:26   ` Joe Perches
2009-01-14  7:13     ` Andrew Morton
2009-01-14  7:21       ` Joe Perches
2009-01-14 19:37       ` Joe Perches [this message]
2009-01-14 19:55         ` Joe Perches
2009-01-14  9:30   ` Pavel Machek

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=1231961837.30095.23.camel@localhost \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox