scripts/get_maintainer.pl: display frequently used tags
PATCH 1/1 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 <[email protected]>
---
What do you think of this?
scripts/get_maintainer.pl +39 -0
@@ -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);
Joe Perches
maintainerQuoted 5 lines · Roel Kluin
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