Message ID | 20230530121447.26236-3-arunisaac@systemreboot.net |
---|---|
State | New |
Headers | show |
Series | Use consolidated X-Debbugs-Cc header | expand |
Hi Arun, Arun Isaac <arunisaac@systemreboot.net> writes: > * mumi/client.scm (send-email): Accept mumi-arg0 argument and > use it to construct --header-cmd. > * scripts/mumi.in: Pass arg0 to send-email. > * tests/client.scm ("send patches to new issue", "send patches to > existing issue", "send single patch to new issue", "send single patch > to existing issue", "send patch to existing issue and Cc other > participants"): Adjust tests. > --- > mumi/client.scm | 9 ++++++--- > scripts/mumi.in | 2 +- > tests/client.scm | 17 ++++++++++++++--- > 3 files changed, 21 insertions(+), 7 deletions(-) > > diff --git a/mumi/client.scm b/mumi/client.scm > index c70fe61..9cb2bd8 100644 > --- a/mumi/client.scm > +++ b/mumi/client.scm > @@ -281,8 +281,9 @@ ISSUE-NUMBER." > (() (list)) > (cc (list (cons 'cc (string-join cc ", ")))))))) > > -(define (send-email patches) > - "Send PATCHES via email." > +(define (send-email mumi-arg0 patches) > + "Send PATCHES via email. MUMI-ARG0 is the mumi program currently > +invoked." > (if (current-issue-number) > ;; If an issue is current, send patches to that issue's email > ;; address. > @@ -290,7 +291,9 @@ ISSUE-NUMBER." > (git-send-email (string-append (number->string issue-number) > "@" > (client-config 'debbugs-host)) > - patches)) > + patches > + (list (string-append "--header-cmd=" > + mumi-arg0 " git-send-email-headers")))) > (match patches > ;; If it's a single patch, send it to the patch email address > ;; and be done with it > diff --git a/scripts/mumi.in b/scripts/mumi.in > index 8fb7cd4..5b98634 100644 > --- a/scripts/mumi.in > +++ b/scripts/mumi.in > @@ -162,7 +162,7 @@ > (("new") > (client:clear-current-issue!)) > (("send-email" . patches) > - (client:send-email patches)) > + (client:send-email (car (program-arguments)) patches)) > (("git-send-email-headers" patch) > (client:git-send-email-headers patch)) > (("mailer" . rest) > diff --git a/tests/client.scm b/tests/client.scm > index 5352b08..fa80dad 100644 > --- a/tests/client.scm > +++ b/tests/client.scm > @@ -80,10 +80,13 @@ called with." > (const 12345)) > client-config-stub) > (cut (@@ (mumi client) send-email) > + "mumi" > (list "foo.patch" "bar.patch" "foobar.patch"))))))) > > (test-equal "send patches to existing issue" > - '(("git" "send-email" "--to=12345@example.com" "foo.patch" "bar.patch" "foobar.patch")) > + '(("git" "send-email" "--to=12345@example.com" > + "--header-cmd=mumi git-send-email-headers" > + "foo.patch" "bar.patch" "foobar.patch")) > (map (match-lambda > ((command _) command)) > (trace-calls (var@@ (mumi client) call-with-input-pipe*) > @@ -95,6 +98,7 @@ called with." > client-config-stub > do-not-poll-server-for-issue-number) > (cut (@@ (mumi client) send-email) > + "mumi" > (list "foo.patch" "bar.patch" "foobar.patch"))))))) > > (test-equal "send single patch to new issue" > @@ -108,10 +112,13 @@ called with." > client-config-stub > do-not-poll-server-for-issue-number) > (cut (@@ (mumi client) send-email) > + "mumi" > (list "foo.patch"))))))) > > (test-equal "send single patch to existing issue" > - '(("git" "send-email" "--to=12345@example.com" "foo.patch")) > + '(("git" "send-email" "--to=12345@example.com" > + "--header-cmd=mumi git-send-email-headers" > + "foo.patch")) > (map (match-lambda > ((command _) command)) > (trace-calls (var@@ (mumi client) call-with-input-pipe*) > @@ -123,10 +130,13 @@ called with." > client-config-stub > do-not-poll-server-for-issue-number) > (cut (@@ (mumi client) send-email) > + "mumi" > (list "foo.patch"))))))) > > (test-equal "send patch to existing issue and Cc other participants" > - '(("git" "send-email" "--to=12345@example.com" "foo.patch")) > + '(("git" "send-email" "--to=12345@example.com" > + "--header-cmd=mumi git-send-email-headers" > + "foo.patch")) > (map (match-lambda > ((command _) command)) > (trace-calls (var@@ (mumi client) call-with-input-pipe*) > @@ -138,6 +148,7 @@ called with." > client-config-stub > do-not-poll-server-for-issue-number) > (cut (@@ (mumi client) send-email) > + "mumi" > (list "foo.patch"))))))) > > (test-end "client") Fun! So mumi now implements its own git 'header command', which builds on top of any pre-configured one such as etc/teams.scm, then overrides said pre-configured headerCmd with itself. LGTM.
diff --git a/mumi/client.scm b/mumi/client.scm index c70fe61..9cb2bd8 100644 --- a/mumi/client.scm +++ b/mumi/client.scm @@ -281,8 +281,9 @@ ISSUE-NUMBER." (() (list)) (cc (list (cons 'cc (string-join cc ", ")))))))) -(define (send-email patches) - "Send PATCHES via email." +(define (send-email mumi-arg0 patches) + "Send PATCHES via email. MUMI-ARG0 is the mumi program currently +invoked." (if (current-issue-number) ;; If an issue is current, send patches to that issue's email ;; address. @@ -290,7 +291,9 @@ ISSUE-NUMBER." (git-send-email (string-append (number->string issue-number) "@" (client-config 'debbugs-host)) - patches)) + patches + (list (string-append "--header-cmd=" + mumi-arg0 " git-send-email-headers")))) (match patches ;; If it's a single patch, send it to the patch email address ;; and be done with it diff --git a/scripts/mumi.in b/scripts/mumi.in index 8fb7cd4..5b98634 100644 --- a/scripts/mumi.in +++ b/scripts/mumi.in @@ -162,7 +162,7 @@ (("new") (client:clear-current-issue!)) (("send-email" . patches) - (client:send-email patches)) + (client:send-email (car (program-arguments)) patches)) (("git-send-email-headers" patch) (client:git-send-email-headers patch)) (("mailer" . rest) diff --git a/tests/client.scm b/tests/client.scm index 5352b08..fa80dad 100644 --- a/tests/client.scm +++ b/tests/client.scm @@ -80,10 +80,13 @@ called with." (const 12345)) client-config-stub) (cut (@@ (mumi client) send-email) + "mumi" (list "foo.patch" "bar.patch" "foobar.patch"))))))) (test-equal "send patches to existing issue" - '(("git" "send-email" "--to=12345@example.com" "foo.patch" "bar.patch" "foobar.patch")) + '(("git" "send-email" "--to=12345@example.com" + "--header-cmd=mumi git-send-email-headers" + "foo.patch" "bar.patch" "foobar.patch")) (map (match-lambda ((command _) command)) (trace-calls (var@@ (mumi client) call-with-input-pipe*) @@ -95,6 +98,7 @@ called with." client-config-stub do-not-poll-server-for-issue-number) (cut (@@ (mumi client) send-email) + "mumi" (list "foo.patch" "bar.patch" "foobar.patch"))))))) (test-equal "send single patch to new issue" @@ -108,10 +112,13 @@ called with." client-config-stub do-not-poll-server-for-issue-number) (cut (@@ (mumi client) send-email) + "mumi" (list "foo.patch"))))))) (test-equal "send single patch to existing issue" - '(("git" "send-email" "--to=12345@example.com" "foo.patch")) + '(("git" "send-email" "--to=12345@example.com" + "--header-cmd=mumi git-send-email-headers" + "foo.patch")) (map (match-lambda ((command _) command)) (trace-calls (var@@ (mumi client) call-with-input-pipe*) @@ -123,10 +130,13 @@ called with." client-config-stub do-not-poll-server-for-issue-number) (cut (@@ (mumi client) send-email) + "mumi" (list "foo.patch"))))))) (test-equal "send patch to existing issue and Cc other participants" - '(("git" "send-email" "--to=12345@example.com" "foo.patch")) + '(("git" "send-email" "--to=12345@example.com" + "--header-cmd=mumi git-send-email-headers" + "foo.patch")) (map (match-lambda ((command _) command)) (trace-calls (var@@ (mumi client) call-with-input-pipe*) @@ -138,6 +148,7 @@ called with." client-config-stub do-not-poll-server-for-issue-number) (cut (@@ (mumi client) send-email) + "mumi" (list "foo.patch"))))))) (test-end "client")