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 @@ and REV-END, two git revision strings." (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 @@ and REV-END, two git revision strings." "Usage: etc/teams.scm [] Commands: - cc get git send-email flags for cc-ing - cc-members cc teams related to files changed between revisions - list-teams list teams and their members - list-members list members belonging to - get-maintainer compatibility mode with Linux get_maintainer.pl~%")))) + cc + get git send-email flags for cc-ing + cc-members | patch + cc teams related to files changed between revisions or in a patch file + list-teams + list teams and their members + list-members + list members belonging to + get-maintainer + compatibility mode with Linux get_maintainer.pl~%")))) (apply main (cdr (command-line)))