GNU bug report logs - #60218
[PATCH 0/2] New teams.scm 'get-maintainer' command (for integration with patman)

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Tue, 20 Dec 2022 13:59:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60218 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, othacehe <at> gnu.org, Maxim Cournoyer <maxim.cournoyer <at> 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
* 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)))
+
 
 (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





This bug report was last modified 2 years and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.