From: Roel Kluin <roel.kluin@gmail.com>
To: joe@perches.com, Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] scripts/get_maintainer.pl: display frequently used tags
Date: Wed, 28 Oct 2009 15:04:07 +0100 [thread overview]
Message-ID: <4AE84F57.9030902@gmail.com> (raw)
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);
next reply other threads:[~2009-10-28 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-28 14:04 Roel Kluin [this message]
2009-10-28 16:00 ` [PATCH] scripts/get_maintainer.pl: display frequently used tags 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=4AE84F57.9030902@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox