unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 60218@debbugs.gnu.org
Cc: rekado@elephly.net, othacehe@gnu.org,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#60218] [PATCH v2 1/3] teams: Add a "get-maintainer" command.
Date: Tue, 27 Dec 2022 10:32:46 -0500	[thread overview]
Message-ID: <20221227153249.16793-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.

---

Changes in v2:
- Move newline character (~%) in usage output to the bottom

 etc/teams.scm.in | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index f42a7f6f28..e50efea786 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))
 
@@ -623,6 +625,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
@@ -631,6 +642,12 @@ (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 (compose symbol->string team-id)
+                   (find-team-by-scope (diff-revisions rev-start rev-end))))))
     (("list-teams" . args)
      (list-teams))
     (("list-members" . team-names)
@@ -646,6 +663,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: 8f93a1e01a879ae026678dd92c18e2a2a49be540
-- 
2.38.1





  parent reply	other threads:[~2022-12-27 15:34 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 ` [bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command Maxim Cournoyer
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 ` Maxim Cournoyer [this message]
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=20221227153249.16793-1-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=60218@debbugs.gnu.org \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    /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).