From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 60218@debbugs.gnu.org
Cc: "Josselin Poiret" <dev@jpoiret.xyz>,
"Tobias Geerinckx-Rice" <me@tobias.gr>,
"Maxim Cournoyer" <maxim.cournoyer@gmail.com>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Ludovic Courtès" <ludo@gnu.org>,
"Christopher Baines" <mail@cbaines.net>,
"Ricardo Wurmus" <rekado@elephly.net>
Subject: [bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command.
Date: Tue, 20 Dec 2022 09:13:29 -0500 [thread overview]
Message-ID: <20221220141330.30372-1-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20221220135810.28175-1-maxim.cournoyer@gmail.com>
This can be used as a compatibility mode with the get_maintainer.pl Perl
script included in the Linux (or U-Boot) source tree.
* etc/teams.scm.in (git-patch->commit-id): New procedure.
(main) <get-maintainer>: Register new command. Document it.
---
etc/teams.scm.in | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index aa38a3b798..4f02df79d5 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -5,6 +5,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -34,6 +35,7 @@
(ice-9 format)
(ice-9 regex)
(ice-9 match)
+ (ice-9 rdelim)
(guix ui)
(git))
@@ -608,6 +610,15 @@ (define (diff-revisions rev-start rev-end)
(const 0))
files))
+(define (git-patch->commit-id file)
+ "Parse the commit ID from the first line of FILE, a patch produced with git."
+ (call-with-input-file file
+ (lambda (port)
+ (let ((m (string-match "^From ([0-9a-f]{40})" (read-line port))))
+ (unless m
+ (error "invalid patch file:" file))
+ (match:substring m 1)))))
+
\f
(define (main . args)
(match args
@@ -616,6 +627,14 @@ (define (main . args)
(("cc-members" rev-start rev-end)
(apply cc (find-team-by-scope
(diff-revisions rev-start rev-end))))
+ (("get-maintainer" patch-file)
+ (let* ((rev-end (git-patch->commit-id patch-file))
+ (rev-start (string-append rev-end "^")))
+ (apply main "list-members"
+ (map symbol->string
+ (map team-id
+ (find-team-by-scope
+ (diff-revisions rev-start rev-end)))))))
(("list-teams" . args)
(list-teams))
(("list-members" . team-names)
@@ -631,6 +650,7 @@ (define (main . args)
cc <team-name> get git send-email flags for cc-ing <team-name>
cc-members <start> <end> cc teams related to files changed between revisions
list-teams list teams and their members
- list-members <team-name> list members belonging to <team-name>~%"))))
+ list-members <team-name> list members belonging to <team-name>~%
+ get-maintainer <patch> compatibility mode with Linux get_maintainer.pl"))))
(apply main (cdr (command-line)))
base-commit: f28ca2447c5e2eef1ba6a3a11587380a665b0e26
--
2.38.1
next prev parent reply other threads:[~2022-12-20 14:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 13:58 [bug#60218] [PATCH 0/2] New teams.scm 'get-maintainer' command (for integration with patman) Maxim Cournoyer
2022-12-20 14:13 ` Maxim Cournoyer [this message]
2022-12-20 14:13 ` [bug#60218] [PATCH 2/2] .patman: New configuration file Maxim Cournoyer
2022-12-24 23:15 ` [bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command Ricardo Wurmus
2022-12-27 3:19 ` Maxim Cournoyer
2022-12-27 10:00 ` [bug#60218] [PATCH 0/2] New teams.scm 'get-maintainer' command (for integration with patman) Mathieu Othacehe
2022-12-27 15:35 ` Maxim Cournoyer
2022-12-28 17:22 ` Mathieu Othacehe
2022-12-28 20:42 ` bug#60218: " Maxim Cournoyer
2022-12-27 15:32 ` [bug#60218] [PATCH v2 1/3] teams: Add a "get-maintainer" command Maxim Cournoyer
2022-12-27 15:32 ` [bug#60218] [PATCH v2 2/3] teams: Allow a patch-file argument to cc-members Maxim Cournoyer
2022-12-27 15:32 ` [bug#60218] [PATCH v2 3/3] .patman: New configuration file Maxim Cournoyer
2023-01-06 17:26 ` Simon Tournier
2023-01-11 15:10 ` zimoun
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221220141330.30372-1-maxim.cournoyer@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=60218@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=ludo@gnu.org \
--cc=mail@cbaines.net \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=rekado@elephly.net \
--cc=zimon.toutoune@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).