From: Palmer Dabbelt <palmer@rivosinc.com>
To: joe@perches.com
Cc: linux-kernel@vger.kernel.org, Palmer Dabbelt <palmer@rivosinc.com>
Subject: [PATCH] get_maintainer: Add the --for-tree argument
Date: Thu, 13 Oct 2022 14:57:38 -0700 [thread overview]
Message-ID: <20221013215738.32326-1-palmer@rivosinc.com> (raw)
I recently wanted to look up the maintainers for each tree path via a
script, and I couldn't find a better way to do that than poking
get_maintainer.pl to add a new argument. This lets folks run something
like
$ ./scripts/get_maintainer.pl --for-tree git://github.com/kvm-riscv/linux.git
Anup Patel <anup@brainfault.org> (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
kvm@vger.kernel.org (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
kvm-riscv@lists.infradead.org (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
linux-riscv@lists.infradead.org (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
to find out who owns a tree.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
scripts/get_maintainer.pl | 48 +++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ab123b498fd9..70abefadd295 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -23,6 +23,7 @@ use File::Spec::Functions;
my $cur_path = fastgetcwd() . '/';
my $lk_path = "./";
+my $for_tree = undef;
my $email = 1;
my $email_usename = 1;
my $email_maintainer = 1;
@@ -239,6 +240,7 @@ if ($#ARGV > 0) {
if (!GetOptions(
'email!' => \$email,
+ 'for-tree=s' => \$for_tree,
'git!' => \$email_git,
'git-all-signature-types!' => \$email_git_all_signature_types,
'git-blame!' => \$email_git_blame,
@@ -300,7 +302,7 @@ if (defined $self_test) {
exit 0;
}
-if (-t STDIN && !@ARGV) {
+if (-t STDIN && !@ARGV && !$for_tree) {
# We're talking to a terminal, but have no command line arguments.
die "$P: missing patchfile or -f file - use --help if necessary\n";
}
@@ -527,7 +529,7 @@ sub read_mailmap {
## use the filenames on the command line or find the filenames in the patchfiles
-if (!@ARGV) {
+if (!@ARGV && !$for_tree) {
push(@ARGV, "&STDIN");
}
@@ -951,6 +953,47 @@ sub get_maintainers {
}
}
+ if ($for_tree) {
+ my $tvi = find_first_section();
+ while ($tvi < @typevalue) {
+ my $start = find_starting_index($tvi);
+ my $end = find_ending_index($tvi);
+ $tvi = $end + 1;
+
+ my $i;
+ my $tree_match = 0;
+ for ($i = $start; $i < $end; $i++) {
+ my $line = $typevalue[$i];
+ if ($line =~ m/^([A-Z]):(.*)/) {
+ my $type = $1;
+ my $value = $2;
+
+ if ($type eq 'T') {
+ if ($for_tree eq $value || "git $for_tree" eq $value) {
+ $tree_match = 1
+ }
+ }
+ }
+ }
+
+ if ($tree_match) {
+ for ($i = $start; $i < $end; $i++) {
+ my $line = $typevalue[$i];
+ if ($line =~ m/^([A-Z]):(.*)/) {
+ my $type = $1;
+ my $value = $2;
+
+ if ($type eq 'M' || $type eq 'L') {
+ my $role = get_maintainer_role($i);
+ push_email_address($value, $role)
+ }
+ }
+ }
+ }
+ }
+ }
+
+
foreach my $email (@email_to, @list_to) {
$email->[0] = deduplicate_email($email->[0]);
}
@@ -1074,6 +1117,7 @@ Output type options:
--multiline => print 1 entry per line
Other options:
+ --for-tree => Get maintainers for the given tree
--pattern-depth => Number of pattern directory traversals (default: 0 (all))
--keywords => scan patch for keywords (default: $keywords)
--sections => print all of the subsystem sections with pattern matches
--
2.38.0
next reply other threads:[~2022-10-13 21:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 21:57 Palmer Dabbelt [this message]
2022-10-14 0:39 ` Joe Perches
2022-10-14 2:56 ` Palmer Dabbelt
2022-10-14 3:48 ` Joe Perches
2022-10-14 3:52 ` Palmer Dabbelt
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=20221013215738.32326-1-palmer@rivosinc.com \
--to=palmer@rivosinc.com \
--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
all inboxes | Powered by JetHome®