all messages for Guix-related lists mirrored at yhetil.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 2/3] teams: Allow a patch-file argument to cc-members.
Date: Tue, 27 Dec 2022 10:32:47 -0500	[thread overview]
Message-ID: <20221227153249.16793-2-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20221227153249.16793-1-maxim.cournoyer@gmail.com>

* etc/teams.scm.in (git-patch->revisions): New procedure.
(main) [cc-members]: New match pattern to support patch file argument.
[get-maintainer]: Simplify using the newly introduced procedure from above.
(main): Update usage doc.

---

Changes in v2:
- New: support passing a patch file to the cc-members command

 etc/teams.scm.in | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index e50efea786..96a04aca3d 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -634,20 +634,29 @@ (define (git-patch->commit-id file)
           (error "invalid patch file:" file))
         (match:substring m 1)))))
 
+(define (git-patch->revisions file)
+  "Return the start and end revisions of FILE, a patch file produced with git."
+  (let* ((rev-end (git-patch->commit-id file))
+         (rev-start (string-append rev-end "^")))
+    (list rev-start rev-end)))
+
 \f
 (define (main . args)
   (match args
     (("cc" . team-names)
      (apply cc (map find-team team-names)))
+    (("cc-members" patch-file)
+     (unless (file-exists? patch-file)
+       (error "patch file does not exist:" patch-file))
+     (apply main "cc-members" (git-patch->revisions patch-file)))
     (("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))))))
+     (apply main "list-members"
+            (map (compose symbol->string team-id)
+                 (find-team-by-scope (apply diff-revisions
+                                            (git-patch->revisions patch-file))))))
     (("list-teams" . args)
      (list-teams))
     (("list-members" . team-names)
@@ -660,10 +669,15 @@ (define (main . args)
              "Usage: etc/teams.scm <command> [<args>]
 
 Commands:
-  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>
-  get-maintainer <patch>    compatibility mode with Linux get_maintainer.pl~%"))))
+  cc <team-name>
+      get git send-email flags for cc-ing <team-name>
+  cc-members <start> <end> | patch
+      cc teams related to files changed between revisions or in a patch file
+  list-teams
+      list teams and their members
+  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)))
-- 
2.38.1





  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 ` [bug#60218] [PATCH v2 1/3] teams: Add a "get-maintainer" command Maxim Cournoyer
2022-12-27 15:32   ` Maxim Cournoyer [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221227153249.16793-2-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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.