public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/get_maintainer.pl: display frequently used tags
@ 2009-10-28 14:04 Roel Kluin
  2009-10-28 16:00 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-10-28 14:04 UTC (permalink / raw)
  To: joe, Andrew Morton, LKML

With the flag --tags, show frequently used tags.

$ ./scripts/get_maintainer.pl --tags -f ./sound/core/
71 times observed tag ALSA:

[maintainer and list email addresses]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
What do you think of this?

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 4673873..89c237d 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -37,6 +37,7 @@ my $scm = 0;
 my $web = 0;
 my $subsystem = 0;
 my $status = 0;
+my $show_tags = 0;
 my $from_filename = 0;
 my $pattern_depth = 0;
 my $version = 0;
@@ -81,6 +82,7 @@ if (!GetOptions(
 		'separator=s' => \$output_separator,
 		'subsystem!' => \$subsystem,
 		'status!' => \$status,
+		'tags!' => \$show_tags,
 		'scm!' => \$scm,
 		'web!' => \$web,
 		'pattern-depth=i' => \$pattern_depth,
@@ -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
+  --tags display frequently used tags
 
 Other options:
   --pattern-depth => Number of pattern directory traversals (default: 0 (all))
@@ -661,6 +664,38 @@ sub mailmap {
     return @lines;
 }
 
+sub show_tag_counts {
+    my @lines = @_;
+    my @tags;
+    my %hash;
+    my $tot_count = 0;
+    my $tag_count = "";
+    my $i;
+    for ($i=0; $i <= $#lines; $i++) {
+    	# tag is below `Date:.*'
+	if ((grep(/^Date:\s+/, $lines[$i])) && ++$i <= $#lines) {
+    	    if ((grep(/^(\[[^]]*\]\s*)*((([^:[:space:]]+\s+){0,2}[^:[:space:]]+:)+)/, $lines[$i]))) {
+		push(@tags, $lines[$i]);
+		$tot_count++;
+	    }
+	}
+    }
+    if ($tot_count == 0) {
+	return;
+    }
+    # cut -d":" -f1
+    s/^([^:]*:).*$/$1/ for (@tags);
+
+    @tags = sort(@tags);
+    $hash{$_}++ for @tags;
+    foreach my $tag (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
+	my $tag_count = $hash{$tag};
+	last if (100 * $tag_count/$tot_count < 50);
+	printf("$tag_count times observed tag $tag\n");
+    }
+    printf("\n");
+}
+
 sub recent_git_signoffs {
     my ($file) = @_;
 
@@ -689,6 +724,10 @@ sub recent_git_signoffs {
 
     @lines = split("\n", $output);
 
+    if ($show_tags) {
+	show_tag_counts(@lines);
+    }
+
     @lines = grep(/^[-_ 	a-z]+by:.*\@.*$/i, @lines);
     if (!$email_git_penguin_chiefs) {
 	@lines = grep(!/${penguin_chiefs}/i, @lines);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts/get_maintainer.pl: display frequently used tags
  2009-10-28 14:04 [PATCH] scripts/get_maintainer.pl: display frequently used tags Roel Kluin
@ 2009-10-28 16:00 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2009-10-28 16:00 UTC (permalink / raw)
  To: Roel Kluin; +Cc: Andrew Morton, LKML

On Wed, 2009-10-28 at 15:04 +0100, Roel Kluin wrote:
> With the flag --tags, show frequently used tags.
> 
> $ ./scripts/get_maintainer.pl --tags -f ./sound/core/
> 71 times observed tag ALSA:
> What do you think of this?

Hi Roel.

I don't see a benefit to finding maintainers for
a particular patch or file/directory here.

I think git should be used for what git does well.

$ git log --since=1-year-ago --format=%s sound/core | grep "ALSA" | wc -l
72

Maybe if something like git log -grep were used to
find patterns and the signers for that pattern.

That's a bit like the recently added "K:" keyword.

cheers, Joe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-28 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-28 14:04 [PATCH] scripts/get_maintainer.pl: display frequently used tags Roel Kluin
2009-10-28 16:00 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox