[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command.
From: |
Maxim Cournoyer |
Subject: |
[bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command. |
Date: |
Tue, 20 Dec 2022 09:13:29 -0500 |
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)))))
+
(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
[bug#60218] [PATCH v2 1/3] teams: Add a "get-maintainer" command., Maxim Cournoyer, 2022/12/27