Subject: [bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 26 Dec 2022 22:19:43 -0500

Hi Ricardo,

Ricardo Wurmus <[email-masked]> writes:

> Hi Maxim,
>
>> 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.
>
> Interesting.
>
>> @@ -616,6 +627,14 @@ (define (main . args)
>>      (("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 "^")))
>
> This is to get the changes introduced by this patch-file right?  In a
> format that allows you to use “diff-revisions” below, which you need to
> run find-team-by-scope.

Yes!  The get-maintainer.pl script expects a single patch file rather
than two git refspecs.

>> +       (apply main "list-members"
>> +              (map symbol->string
>> +                   (map team-id
>> +                        (find-team-by-scope
>> +                         (diff-revisions rev-start rev-end)))))))
>
> Here I’d do
>
>     (map (compose symbol->string team-id) …)
>
> instead of mapping twice.

Thanks, that's better.  Adjusted locally.

> I haven’t used get_maintainer.pl before, but I don’t object to this
> change if it’s useful to you.

It's useful in conjunction with patman (which is patch 2/2 of this
series), which can be configured to use a get-maintainer like script to
retrieve the people it should CC based on the patches it can 'git
send-email' for you.  If nobody else has a say, I'll push in about a
week.

Thanks for taking a look!

-- 
Maxim