me
/
guix
Archived
1
0
Fork 0

teams: Add a "get-maintainer" command.

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.

Series-changes: 2
- Move newline character (~%) in usage output to the bottom
master
Maxim Cournoyer 2022-12-19 16:17:10 -05:00
parent bbada5967d
commit 4f5ea195ff
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 19 additions and 1 deletions

View File

@ -5,6 +5,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org> ;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -34,6 +35,7 @@
(ice-9 format) (ice-9 format)
(ice-9 regex) (ice-9 regex)
(ice-9 match) (ice-9 match)
(ice-9 rdelim)
(guix ui) (guix ui)
(git)) (git))
@ -623,6 +625,15 @@ and REV-END, two git revision strings."
(const 0)) (const 0))
files)) 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) (define (main . args)
(match args (match args
@ -631,6 +642,12 @@ and REV-END, two git revision strings."
(("cc-members" rev-start rev-end) (("cc-members" rev-start rev-end)
(apply cc (find-team-by-scope (apply cc (find-team-by-scope
(diff-revisions rev-start rev-end)))) (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" . args)
(list-teams)) (list-teams))
(("list-members" . team-names) (("list-members" . team-names)
@ -646,6 +663,7 @@ Commands:
cc <team-name> get git send-email flags for cc-ing <team-name> 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 cc-members <start> <end> cc teams related to files changed between revisions
list-teams list teams and their members 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))) (apply main (cdr (command-line)))