* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
@ 2023-05-01 20:56 Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email Arun Isaac
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Arun Isaac @ 2023-05-01 20:56 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
Hi,
This patchset makes mumi send-email automatically Cc all issue
participants. I will push this patchset in a few days unless there are
objections.
Cheers!
Arun
Arun Isaac (2):
client: Support passing options to git send-email.
client: Cc issue participants when sending email.
mumi/client.scm | 44 ++++++++++++++++++++++++++++++++++++--------
tests/client.scm | 24 ++++++++++++++++++++++++
2 files changed, 60 insertions(+), 8 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email.
2023-05-01 20:56 [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email Arun Isaac
@ 2023-05-01 21:01 ` Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 2/2] client: Cc issue participants when sending email Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants Arun Isaac
2023-05-06 22:35 ` [bug#63215] [PATCH 1/2] client: Support passing options to git send-email Arun Isaac
2 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2023-05-01 21:01 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
* mumi/client.scm (git-send-email): Add options optional argument.
---
mumi/client.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mumi/client.scm b/mumi/client.scm
index b8d588b..2750836 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -207,12 +207,13 @@ arguments."
(cut proc port)
(cut close-pipe port))))))
-(define (git-send-email to patches)
- "Send PATCHES using git send-email to the TO address and return the
-message ID of the first email sent."
+(define* (git-send-email to patches #:optional (options '()))
+ "Send PATCHES using git send-email to the TO address with
+OPTIONS. Return the message ID of the first email sent."
(let ((command (cons* "git" "send-email"
(string-append "--to=" to)
- patches)))
+ (append options
+ patches))))
(display (string-join command))
(newline)
(call-with-input-pipe command
--
2.39.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 2/2] client: Cc issue participants when sending email.
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email Arun Isaac
@ 2023-05-01 21:01 ` Arun Isaac
0 siblings, 0 replies; 15+ messages in thread
From: Arun Isaac @ 2023-05-01 21:01 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
* mumi/client.scm: Import (srfi srfi-1).
(reply-email-headers): New function.
(send-email): Call reply-email-headers.
* tests/client.scm ("send patches to existing issue", "send single
patch to existing issue"): Stub reply-email-headers.
("send patch to existing issue and Cc other participants"): New test.
---
mumi/client.scm | 35 +++++++++++++++++++++++++++++++----
tests/client.scm | 24 ++++++++++++++++++++++++
2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/mumi/client.scm b/mumi/client.scm
index 2750836..0ad49fc 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -18,6 +18,7 @@
(define-module (mumi client)
#:use-module (rnrs io ports)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-43)
@@ -236,15 +237,41 @@ OPTIONS. Return the message ID of the first email sent."
(display (get-string-all port))
message-id)))))
+(define (reply-email-headers issue-number)
+ "Return an association list of email headers when replying to
+ISSUE-NUMBER."
+ (let ((messages
+ (assoc-ref
+ (assoc-ref
+ (graphql-http-get (graphql-endpoint)
+ `(document
+ (query (#(issue #:number ,issue-number)
+ (messages (from name)
+ date)))))
+ "issue")
+ "messages")))
+ ;; When sending email to an issue, we Cc all issue participants.
+ ;; TODO: Also add an In-Reply-To header.
+ `((cc . ,(delete-duplicates
+ (map (lambda (message)
+ (let ((from (assoc-ref message "from")))
+ (string-append (assoc-ref from "name")
+ " <" (assoc-ref from "address") ">")))
+ (vector->list messages)))))))
+
(define (send-email patches)
"Send PATCHES via email."
(if (current-issue-number)
;; If an issue is current, send patches to that issue's email
;; address.
- (git-send-email (string-append (number->string (current-issue-number))
- "@"
- (client-config 'debbugs-host))
- patches)
+ (let ((issue-number (current-issue-number)))
+ (git-send-email (string-append (number->string issue-number)
+ "@"
+ (client-config 'debbugs-host))
+ patches
+ (map (cut string-append "--cc=" <>)
+ (assq-ref (reply-email-headers issue-number)
+ 'cc))))
(match patches
;; If it's a single patch, send it to the patch email address
;; and be done with it
diff --git a/tests/client.scm b/tests/client.scm
index 94c8c5d..f0ff34e 100644
--- a/tests/client.scm
+++ b/tests/client.scm
@@ -90,6 +90,8 @@ called with."
(lambda ()
(with-variables (list (cons (var@@ (mumi client) current-issue-number)
(const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const '((cc))))
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
@@ -116,6 +118,28 @@ called with."
(lambda ()
(with-variables (list (cons (var@@ (mumi client) current-issue-number)
(const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const '((cc))))
+ client-config-stub
+ do-not-poll-server-for-issue-number)
+ (cut (@@ (mumi client) send-email)
+ (list "foo.patch")))))))
+
+(test-equal "send patch to existing issue and Cc other participants"
+ '(("git" "send-email"
+ "--to=12345@example.com"
+ "--cc=John Doe <jdoe@machine.example>"
+ "--cc=Mary Smith <mary@example.net>"
+ "foo.patch"))
+ (map (match-lambda
+ ((command _) command))
+ (trace-calls (var@@ (mumi client) call-with-input-pipe)
+ (lambda ()
+ (with-variables (list (cons (var@@ (mumi client) current-issue-number)
+ (const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const `((cc "John Doe <jdoe@machine.example>"
+ "Mary Smith <mary@example.net>"))))
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
--
2.39.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants
2023-05-01 20:56 [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email Arun Isaac
@ 2023-05-01 22:51 ` Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 2/2] client: Cc issue participants when sending email Arun Isaac
2023-05-06 22:35 ` [bug#63215] [PATCH 1/2] client: Support passing options to git send-email Arun Isaac
2 siblings, 2 replies; 15+ messages in thread
From: Arun Isaac @ 2023-05-01 22:51 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
I have fixed a bug in the v1 patchset with fetching participants'
addresses. Please consider this v2 patchset instead.
Arun Isaac (2):
client: Support passing options to git send-email.
client: Cc issue participants when sending email.
mumi/client.scm | 44 ++++++++++++++++++++++++++++++++++++--------
tests/client.scm | 24 ++++++++++++++++++++++++
2 files changed, 60 insertions(+), 8 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH v2 mumi 1/2] client: Support passing options to git send-email.
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants Arun Isaac
@ 2023-05-01 22:51 ` Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 2/2] client: Cc issue participants when sending email Arun Isaac
1 sibling, 0 replies; 15+ messages in thread
From: Arun Isaac @ 2023-05-01 22:51 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
* mumi/client.scm (git-send-email): Add options optional argument.
---
mumi/client.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mumi/client.scm b/mumi/client.scm
index b8d588b..2750836 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -207,12 +207,13 @@ arguments."
(cut proc port)
(cut close-pipe port))))))
-(define (git-send-email to patches)
- "Send PATCHES using git send-email to the TO address and return the
-message ID of the first email sent."
+(define* (git-send-email to patches #:optional (options '()))
+ "Send PATCHES using git send-email to the TO address with
+OPTIONS. Return the message ID of the first email sent."
(let ((command (cons* "git" "send-email"
(string-append "--to=" to)
- patches)))
+ (append options
+ patches))))
(display (string-join command))
(newline)
(call-with-input-pipe command
--
2.39.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH v2 mumi 2/2] client: Cc issue participants when sending email.
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 1/2] client: Support passing options to git send-email Arun Isaac
@ 2023-05-01 22:51 ` Arun Isaac
2023-05-03 2:39 ` [bug#63215] [PATCH mumi 0/2] Cc all " Maxim Cournoyer
1 sibling, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2023-05-01 22:51 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
* mumi/client.scm: Import (srfi srfi-1).
(reply-email-headers): New function.
(send-email): Call reply-email-headers.
* tests/client.scm ("send patches to existing issue", "send single
patch to existing issue"): Stub reply-email-headers.
("send patch to existing issue and Cc other participants"): New test.
---
mumi/client.scm | 35 +++++++++++++++++++++++++++++++----
tests/client.scm | 24 ++++++++++++++++++++++++
2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/mumi/client.scm b/mumi/client.scm
index 2750836..f0e4321 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -18,6 +18,7 @@
(define-module (mumi client)
#:use-module (rnrs io ports)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-43)
@@ -236,15 +237,41 @@ OPTIONS. Return the message ID of the first email sent."
(display (get-string-all port))
message-id)))))
+(define (reply-email-headers issue-number)
+ "Return an association list of email headers when replying to
+ISSUE-NUMBER."
+ (let ((messages
+ (assoc-ref
+ (assoc-ref
+ (graphql-http-get (graphql-endpoint)
+ `(document
+ (query (#(issue #:number ,issue-number)
+ (messages (from name address)
+ date)))))
+ "issue")
+ "messages")))
+ ;; When sending email to an issue, we Cc all issue participants.
+ ;; TODO: Also add an In-Reply-To header.
+ `((cc . ,(delete-duplicates
+ (map (lambda (message)
+ (let ((from (assoc-ref message "from")))
+ (string-append (assoc-ref from "name")
+ " <" (assoc-ref from "address") ">")))
+ (vector->list messages)))))))
+
(define (send-email patches)
"Send PATCHES via email."
(if (current-issue-number)
;; If an issue is current, send patches to that issue's email
;; address.
- (git-send-email (string-append (number->string (current-issue-number))
- "@"
- (client-config 'debbugs-host))
- patches)
+ (let ((issue-number (current-issue-number)))
+ (git-send-email (string-append (number->string issue-number)
+ "@"
+ (client-config 'debbugs-host))
+ patches
+ (map (cut string-append "--cc=" <>)
+ (assq-ref (reply-email-headers issue-number)
+ 'cc))))
(match patches
;; If it's a single patch, send it to the patch email address
;; and be done with it
diff --git a/tests/client.scm b/tests/client.scm
index 94c8c5d..f0ff34e 100644
--- a/tests/client.scm
+++ b/tests/client.scm
@@ -90,6 +90,8 @@ called with."
(lambda ()
(with-variables (list (cons (var@@ (mumi client) current-issue-number)
(const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const '((cc))))
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
@@ -116,6 +118,28 @@ called with."
(lambda ()
(with-variables (list (cons (var@@ (mumi client) current-issue-number)
(const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const '((cc))))
+ client-config-stub
+ do-not-poll-server-for-issue-number)
+ (cut (@@ (mumi client) send-email)
+ (list "foo.patch")))))))
+
+(test-equal "send patch to existing issue and Cc other participants"
+ '(("git" "send-email"
+ "--to=12345@example.com"
+ "--cc=John Doe <jdoe@machine.example>"
+ "--cc=Mary Smith <mary@example.net>"
+ "foo.patch"))
+ (map (match-lambda
+ ((command _) command))
+ (trace-calls (var@@ (mumi client) call-with-input-pipe)
+ (lambda ()
+ (with-variables (list (cons (var@@ (mumi client) current-issue-number)
+ (const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const `((cc "John Doe <jdoe@machine.example>"
+ "Mary Smith <mary@example.net>"))))
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
--
2.39.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 2/2] client: Cc issue participants when sending email Arun Isaac
@ 2023-05-03 2:39 ` Maxim Cournoyer
2023-05-05 2:00 ` Arun Isaac
0 siblings, 1 reply; 15+ messages in thread
From: Maxim Cournoyer @ 2023-05-03 2:39 UTC (permalink / raw)
To: Arun Isaac; +Cc: 63215
Hi Arun,
Arun Isaac <arunisaac@systemreboot.net> writes:
> * mumi/client.scm: Import (srfi srfi-1).
> (reply-email-headers): New function.
> (send-email): Call reply-email-headers.
> * tests/client.scm ("send patches to existing issue", "send single
> patch to existing issue"): Stub reply-email-headers.
> ("send patch to existing issue and Cc other participants"): New test.
Great series!
> ---
> mumi/client.scm | 35 +++++++++++++++++++++++++++++++----
> tests/client.scm | 24 ++++++++++++++++++++++++
> 2 files changed, 55 insertions(+), 4 deletions(-)
>
> diff --git a/mumi/client.scm b/mumi/client.scm
> index 2750836..f0e4321 100644
> --- a/mumi/client.scm
> +++ b/mumi/client.scm
> @@ -18,6 +18,7 @@
>
> (define-module (mumi client)
> #:use-module (rnrs io ports)
> + #:use-module (srfi srfi-1)
> #:use-module (srfi srfi-19)
> #:use-module (srfi srfi-26)
> #:use-module (srfi srfi-43)
> @@ -236,15 +237,41 @@ OPTIONS. Return the message ID of the first email sent."
> (display (get-string-all port))
> message-id)))))
>
> +(define (reply-email-headers issue-number)
> + "Return an association list of email headers when replying to
> +ISSUE-NUMBER."
> + (let ((messages
> + (assoc-ref
> + (assoc-ref
> + (graphql-http-get (graphql-endpoint)
> + `(document
> + (query (#(issue #:number ,issue-number)
> + (messages (from name address)
> + date)))))
> + "issue")
> + "messages")))
> + ;; When sending email to an issue, we Cc all issue participants.
> + ;; TODO: Also add an In-Reply-To header.
> + `((cc . ,(delete-duplicates
> + (map (lambda (message)
> + (let ((from (assoc-ref message "from")))
> + (string-append (assoc-ref from "name")
> + " <" (assoc-ref from "address") ">")))
> + (vector->list messages)))))))
> +
> (define (send-email patches)
> "Send PATCHES via email."
> (if (current-issue-number)
> ;; If an issue is current, send patches to that issue's email
> ;; address.
> - (git-send-email (string-append (number->string (current-issue-number))
> - "@"
> - (client-config 'debbugs-host))
> - patches)
> + (let ((issue-number (current-issue-number)))
> + (git-send-email (string-append (number->string issue-number)
> + "@"
> + (client-config 'debbugs-host))
> + patches
> + (map (cut string-append "--cc=" <>)
> + (assq-ref (reply-email-headers issue-number)
> + 'cc))))
I was thinking looking at this, with X-Debbugs-Cc headers now being
added automatically by Git for members of a team, there could be
duplication between X-Debbugs-Cc and the participannts retrieved from
the messages above.
To ensure participants do not receive duplicate replies, it'd be
probably best to stick to using X-Debbugs-Cc with all interactions with
Debbugs; this way a duplicate header is (hopefully) ignored by Debbugs
itself.
Does that make sense?
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-03 2:39 ` [bug#63215] [PATCH mumi 0/2] Cc all " Maxim Cournoyer
@ 2023-05-05 2:00 ` Arun Isaac
2023-05-05 13:24 ` Arun Isaac
0 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2023-05-05 2:00 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 63215
Hi Maxim,
> I was thinking looking at this, with X-Debbugs-Cc headers now being
> added automatically by Git for members of a team, there could be
> duplication between X-Debbugs-Cc and the participannts retrieved from
> the messages above.
>
> To ensure participants do not receive duplicate replies, it'd be
> probably best to stick to using X-Debbugs-Cc with all interactions with
> Debbugs; this way a duplicate header is (hopefully) ignored by Debbugs
> itself.
>
> Does that make sense?
Yes, that makes sense! I will send a new patchset. According to
https://www.debian.org/Bugs/Reporting#xcc , if we want to send copies to
multiple addresses, we should put them in as a comma-separated list in
the same X-Debbugs-Cc header. teams.scm seems to be putting in multiple
X-Debbugs-Cc headers. Maybe we should change that?
I see mumi as being more widely usable than just for Guix. For example,
I wish to use it for skribilo, another Guile project that uses the
Debbugs issue tracker. So, in the future, if and when applicable, we
might want to move some of teams.scm's functionality into `mumi
send-email'.
Regards,
Arun
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-05 2:00 ` Arun Isaac
@ 2023-05-05 13:24 ` Arun Isaac
2023-05-05 16:18 ` Maxim Cournoyer
0 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2023-05-05 13:24 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 63215
> Yes, that makes sense! I will send a new patchset. According to
> https://www.debian.org/Bugs/Reporting#xcc , if we want to send copies to
> multiple addresses, we should put them in as a comma-separated list in
> the same X-Debbugs-Cc header. teams.scm seems to be putting in multiple
> X-Debbugs-Cc headers. Maybe we should change that?
I just realized that using comma-separated lists calls for the
functionality of teams.scm to be moved into `mumi send-email'. If
teams.scm and `mumi send-email' remain separate, they will each produce
a separate comma-separated list of X-Debbugs-Cc addresses, and we will
be back to square one with multiple X-Debbugs-Cc headers.
WDYT? What is the best way forward?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-05 13:24 ` Arun Isaac
@ 2023-05-05 16:18 ` Maxim Cournoyer
2023-05-06 22:30 ` Arun Isaac
0 siblings, 1 reply; 15+ messages in thread
From: Maxim Cournoyer @ 2023-05-05 16:18 UTC (permalink / raw)
To: Arun Isaac; +Cc: 63215
Hi Arun,
Arun Isaac <arunisaac@systemreboot.net> writes:
>> Yes, that makes sense! I will send a new patchset. According to
>> https://www.debian.org/Bugs/Reporting#xcc , if we want to send copies to
>> multiple addresses, we should put them in as a comma-separated list in
>> the same X-Debbugs-Cc header. teams.scm seems to be putting in multiple
>> X-Debbugs-Cc headers. Maybe we should change that?
>
> I just realized that using comma-separated lists calls for the
> functionality of teams.scm to be moved into `mumi send-email'. If
> teams.scm and `mumi send-email' remain separate, they will each produce
> a separate comma-separated list of X-Debbugs-Cc addresses, and we will
> be back to square one with multiple X-Debbugs-Cc headers.
>
> WDYT? What is the best way forward?
If you meant that it's mumi instead of git that should call
etc/teams.scm, it makes sense. I'm not sure the functionality of
teams.scm proper should be moved wholesale into mumi, as it's useful
outside of mumi (for plain git users, say).
Mumi could invoke etc/teams.scm to produce the list of team members for
the changes involved, add any missing collaborators retrieved from the
message data to the set (avoiding duplicates), then format the
'X-Debbugs-CC' header with comma-separated values. It should then
invoke git with the '--no-header-cmd' option to avoid teams.scm being
called again.
Note that our teams.scm script currently generate distinct X-Debbugs-CC
header for each participant. The Debbugs copy used by GNU is the one
hosted at [0], which doesn't mention the comma-separated
requirement/suggestion, so I think that's currently OK, although I'm not
too confident in my reading of the 'process' Perl script [1]. At any
rate it'd be easy to adjust in teams.scm.
The email specification mentions that some special fields such as To and
Cc should be separated by commas, but says nothing about custom fields [2],
so in my opinion both forms should be supported by Debbugs (and probably
are, although it's hard to say without trying).
[0] https://gitlab.com/npostavs/debbugs/-/tree/gnu-reconstruction?ref_type=heads
[1] https://gitlab.com/npostavs/debbugs/-/blob/gnu-reconstruction/scripts/process
[2] https://datatracker.ietf.org/doc/html/rfc5322#section-3.6
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-05 16:18 ` Maxim Cournoyer
@ 2023-05-06 22:30 ` Arun Isaac
2023-05-07 2:27 ` Maxim Cournoyer
0 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2023-05-06 22:30 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 63215
Hi Maxim,
> If you meant that it's mumi instead of git that should call
> etc/teams.scm, it makes sense. I'm not sure the functionality of
> teams.scm proper should be moved wholesale into mumi, as it's useful
> outside of mumi (for plain git users, say).
I see your point about keeping things working for plain git users. Makes
sense.
> Mumi could invoke etc/teams.scm to produce the list of team members for
> the changes involved, add any missing collaborators retrieved from the
> message data to the set (avoiding duplicates), then format the
> 'X-Debbugs-CC' header with comma-separated values. It should then
> invoke git with the '--no-header-cmd' option to avoid teams.scm being
> called again.
mumi invoking etc/teams.scm is not so nice since that means coupling
mumi to the specific repository layout of guix. This reduces its
generality to other projects, say skribilo.
Maybe, let's just keep multiple X-Debbugs-Cc headers for now. Let mumi
and teams.scm be unaware of each other for now. We can revisit the
question of coupling them later.
> Note that our teams.scm script currently generate distinct X-Debbugs-CC
> header for each participant. The Debbugs copy used by GNU is the one
> hosted at [0], which doesn't mention the comma-separated
> requirement/suggestion, so I think that's currently OK, although I'm not
> too confident in my reading of the 'process' Perl script [1]. At any
> rate it'd be easy to adjust in teams.scm.
>
> The email specification mentions that some special fields such as To and
> Cc should be separated by commas, but says nothing about custom fields [2],
> so in my opinion both forms should be supported by Debbugs (and probably
> are, although it's hard to say without trying).
Fair enough. Let's keep multiple X-Debbugs-Cc headers and hope for the
best! :-) A new patchset follows. The only difference between this
patchset and the previous one is that we set X-Debbugs-Cc headers
instead of Cc headers.
Regards,
Arun
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH 1/2] client: Support passing options to git send-email.
2023-05-01 20:56 [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants Arun Isaac
@ 2023-05-06 22:35 ` Arun Isaac
2023-05-06 22:35 ` [bug#63215] [PATCH 2/2] client: Cc issue participants when sending email Arun Isaac
2 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2023-05-06 22:35 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
* mumi/client.scm (git-send-email): Add options optional argument.
---
mumi/client.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mumi/client.scm b/mumi/client.scm
index b8d588b..2750836 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -207,12 +207,13 @@ arguments."
(cut proc port)
(cut close-pipe port))))))
-(define (git-send-email to patches)
- "Send PATCHES using git send-email to the TO address and return the
-message ID of the first email sent."
+(define* (git-send-email to patches #:optional (options '()))
+ "Send PATCHES using git send-email to the TO address with
+OPTIONS. Return the message ID of the first email sent."
(let ((command (cons* "git" "send-email"
(string-append "--to=" to)
- patches)))
+ (append options
+ patches))))
(display (string-join command))
(newline)
(call-with-input-pipe command
--
2.39.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH 2/2] client: Cc issue participants when sending email.
2023-05-06 22:35 ` [bug#63215] [PATCH 1/2] client: Support passing options to git send-email Arun Isaac
@ 2023-05-06 22:35 ` Arun Isaac
0 siblings, 0 replies; 15+ messages in thread
From: Arun Isaac @ 2023-05-06 22:35 UTC (permalink / raw)
To: 63215; +Cc: Arun Isaac
* mumi/client.scm: Import (srfi srfi-1).
(reply-email-headers): New function.
(send-email): Call reply-email-headers.
* tests/client.scm ("send patches to existing issue", "send single
patch to existing issue"): Stub reply-email-headers.
("send patch to existing issue and Cc other participants"): New test.
---
mumi/client.scm | 36 ++++++++++++++++++++++++++++++++----
tests/client.scm | 25 +++++++++++++++++++++++++
2 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/mumi/client.scm b/mumi/client.scm
index 2750836..7ba47e6 100644
--- a/mumi/client.scm
+++ b/mumi/client.scm
@@ -18,6 +18,7 @@
(define-module (mumi client)
#:use-module (rnrs io ports)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-43)
@@ -236,15 +237,42 @@ OPTIONS. Return the message ID of the first email sent."
(display (get-string-all port))
message-id)))))
+(define (reply-email-headers issue-number)
+ "Return an association list of email headers when replying to
+ISSUE-NUMBER."
+ (let ((messages
+ (assoc-ref
+ (assoc-ref
+ (graphql-http-get (graphql-endpoint)
+ `(document
+ (query (#(issue #:number ,issue-number)
+ (messages (from name address)
+ date)))))
+ "issue")
+ "messages")))
+ ;; When sending email to an issue, we Cc all issue participants.
+ ;; TODO: Also add an In-Reply-To header.
+ `((x-debbugs-cc
+ . ,(delete-duplicates
+ (map (lambda (message)
+ (let ((from (assoc-ref message "from")))
+ (string-append (assoc-ref from "name")
+ " <" (assoc-ref from "address") ">")))
+ (vector->list messages)))))))
+
(define (send-email patches)
"Send PATCHES via email."
(if (current-issue-number)
;; If an issue is current, send patches to that issue's email
;; address.
- (git-send-email (string-append (number->string (current-issue-number))
- "@"
- (client-config 'debbugs-host))
- patches)
+ (let ((issue-number (current-issue-number)))
+ (git-send-email (string-append (number->string issue-number)
+ "@"
+ (client-config 'debbugs-host))
+ patches
+ (map (cut string-append "--add-header=X-Debbugs-Cc: " <>)
+ (assq-ref (reply-email-headers issue-number)
+ 'x-debbugs-cc))))
(match patches
;; If it's a single patch, send it to the patch email address
;; and be done with it
diff --git a/tests/client.scm b/tests/client.scm
index 94c8c5d..1d40c10 100644
--- a/tests/client.scm
+++ b/tests/client.scm
@@ -90,6 +90,8 @@ called with."
(lambda ()
(with-variables (list (cons (var@@ (mumi client) current-issue-number)
(const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const '((x-debbugs-cc))))
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
@@ -116,6 +118,29 @@ called with."
(lambda ()
(with-variables (list (cons (var@@ (mumi client) current-issue-number)
(const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const '((x-debbugs-cc))))
+ client-config-stub
+ do-not-poll-server-for-issue-number)
+ (cut (@@ (mumi client) send-email)
+ (list "foo.patch")))))))
+
+(test-equal "send patch to existing issue and Cc other participants"
+ '(("git" "send-email"
+ "--to=12345@example.com"
+ "--add-header=X-Debbugs-Cc: John Doe <jdoe@machine.example>"
+ "--add-header=X-Debbugs-Cc: Mary Smith <mary@example.net>"
+ "foo.patch"))
+ (map (match-lambda
+ ((command _) command))
+ (trace-calls (var@@ (mumi client) call-with-input-pipe)
+ (lambda ()
+ (with-variables (list (cons (var@@ (mumi client) current-issue-number)
+ (const 12345))
+ (cons (var@@ (mumi client) reply-email-headers)
+ (const `((x-debbugs-cc
+ "John Doe <jdoe@machine.example>"
+ "Mary Smith <mary@example.net>"))))
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
--
2.39.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-06 22:30 ` Arun Isaac
@ 2023-05-07 2:27 ` Maxim Cournoyer
2023-05-07 11:27 ` bug#63215: " Arun Isaac
0 siblings, 1 reply; 15+ messages in thread
From: Maxim Cournoyer @ 2023-05-07 2:27 UTC (permalink / raw)
To: Arun Isaac; +Cc: 63215
Hi Arun,
Arun Isaac <arunisaac@systemreboot.net> writes:
> Hi Maxim,
>
>> If you meant that it's mumi instead of git that should call
>> etc/teams.scm, it makes sense. I'm not sure the functionality of
>> teams.scm proper should be moved wholesale into mumi, as it's useful
>> outside of mumi (for plain git users, say).
>
> I see your point about keeping things working for plain git users. Makes
> sense.
>
>> Mumi could invoke etc/teams.scm to produce the list of team members for
>> the changes involved, add any missing collaborators retrieved from the
>> message data to the set (avoiding duplicates), then format the
>> 'X-Debbugs-CC' header with comma-separated values. It should then
>> invoke git with the '--no-header-cmd' option to avoid teams.scm being
>> called again.
>
> mumi invoking etc/teams.scm is not so nice since that means coupling
> mumi to the specific repository layout of guix. This reduces its
> generality to other projects, say skribilo.
Perhaps it could use the value of `git config sendemail.headerCmd` to
figure out which script already produces X-Debbugs-CC headers, if any.
> Maybe, let's just keep multiple X-Debbugs-Cc headers for now. Let mumi
> and teams.scm be unaware of each other for now. We can revisit the
> question of coupling them later.
OK, sounds good to me.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#63215: [PATCH mumi 0/2] Cc all issue participants when sending email
2023-05-07 2:27 ` Maxim Cournoyer
@ 2023-05-07 11:27 ` Arun Isaac
0 siblings, 0 replies; 15+ messages in thread
From: Arun Isaac @ 2023-05-07 11:27 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 63215-done
> Perhaps it could use the value of `git config sendemail.headerCmd` to
> figure out which script already produces X-Debbugs-CC headers, if any.
That's a good idea! We can revisit this later.
>> Maybe, let's just keep multiple X-Debbugs-Cc headers for now. Let mumi
>> and teams.scm be unaware of each other for now. We can revisit the
>> question of coupling them later.
>
> OK, sounds good to me.
Pushed, thanks!
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2023-05-07 11:29 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-01 20:56 [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 2/2] client: Cc issue participants when sending email Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 2/2] client: Cc issue participants when sending email Arun Isaac
2023-05-03 2:39 ` [bug#63215] [PATCH mumi 0/2] Cc all " Maxim Cournoyer
2023-05-05 2:00 ` Arun Isaac
2023-05-05 13:24 ` Arun Isaac
2023-05-05 16:18 ` Maxim Cournoyer
2023-05-06 22:30 ` Arun Isaac
2023-05-07 2:27 ` Maxim Cournoyer
2023-05-07 11:27 ` bug#63215: " Arun Isaac
2023-05-06 22:35 ` [bug#63215] [PATCH 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-06 22:35 ` [bug#63215] [PATCH 2/2] client: Cc issue participants when sending email Arun Isaac
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).