teams: Allow a patch-file argument to cc-members.
* 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. Series-changes: 2 - New: support passing a patch file to the cc-members command
This commit is contained in:
parent
4f5ea195ff
commit
a6b98cdc07
|
@ -634,20 +634,29 @@ and REV-END, two git revision strings."
|
||||||
(error "invalid patch file:" file))
|
(error "invalid patch file:" file))
|
||||||
(match:substring m 1)))))
|
(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)
|
(define (main . args)
|
||||||
(match args
|
(match args
|
||||||
(("cc" . team-names)
|
(("cc" . team-names)
|
||||||
(apply cc (map find-team 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)
|
(("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)
|
(("get-maintainer" patch-file)
|
||||||
(let* ((rev-end (git-patch->commit-id patch-file))
|
(apply main "list-members"
|
||||||
(rev-start (string-append rev-end "^")))
|
(map (compose symbol->string team-id)
|
||||||
(apply main "list-members"
|
(find-team-by-scope (apply diff-revisions
|
||||||
(map (compose symbol->string team-id)
|
(git-patch->revisions patch-file))))))
|
||||||
(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)
|
||||||
|
@ -660,10 +669,15 @@ and REV-END, two git revision strings."
|
||||||
"Usage: etc/teams.scm <command> [<args>]
|
"Usage: etc/teams.scm <command> [<args>]
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
cc <team-name> get git send-email flags for cc-ing <team-name>
|
cc <team-name>
|
||||||
cc-members <start> <end> cc teams related to files changed between revisions
|
get git send-email flags for cc-ing <team-name>
|
||||||
list-teams list teams and their members
|
cc-members <start> <end> | patch
|
||||||
list-members <team-name> list members belonging to <team-name>
|
cc teams related to files changed between revisions or in a patch file
|
||||||
get-maintainer <patch> compatibility mode with Linux get_maintainer.pl~%"))))
|
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)))
|
(apply main (cdr (command-line)))
|
||||||
|
|
Loading…
Reference in New Issue