Messages in this thread Patch in this message |  | | | Date | Wed, 28 Oct 2009 15:04:07 +0100 | | From | Roel Kluin <> | | Subject | [PATCH] scripts/get_maintainer.pl: display frequently used tags |
| |
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);
|  |