From patchwork Thu Jun 8 17:14:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Isaac X-Patchwork-Id: 50770 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1506C27BBEE; Thu, 8 Jun 2023 18:16:41 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id ED1DE27BBEA for ; Thu, 8 Jun 2023 18:16:39 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7JEz-0003T5-Oj; Thu, 08 Jun 2023 13:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7JEy-0003Rn-3G for guix-patches@gnu.org; Thu, 08 Jun 2023 13:16:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7JEx-0007jH-Qu for guix-patches@gnu.org; Thu, 08 Jun 2023 13:16:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7JEw-0008P4-EF; Thu, 08 Jun 2023 13:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63802] [PATCH 1/3] client: Separate serialize-email-address into a function. References: <20230530121132.26057-1-arunisaac@systemreboot.net> In-Reply-To: <20230530121132.26057-1-arunisaac@systemreboot.net> Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: arunisaac@systemreboot.net, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 08 Jun 2023 17:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63802@debbugs.gnu.org Cc: Arun Isaac , Arun Isaac , Maxim Cournoyer X-Debbugs-Original-Xcc: Arun Isaac , Maxim Cournoyer Received: via spool by 63802-submit@debbugs.gnu.org id=B63802.168624452832244 (code B ref 63802); Thu, 08 Jun 2023 17:16:02 +0000 Received: (at 63802) by debbugs.gnu.org; 8 Jun 2023 17:15:28 +0000 Received: from localhost ([127.0.0.1]:57432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7JEO-0008Nv-CC for submit@debbugs.gnu.org; Thu, 08 Jun 2023 13:15:28 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:53218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7JEI-0008NM-KY for 63802@debbugs.gnu.org; Thu, 08 Jun 2023 13:15:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VLicOmtPWuLioUpjienGnh8ece+vix/OAeeBScqY8zU=; b=dIC672Lxoj07WIf1SZT8PEYGgQ WAuclSB1MhnjLzGp/4wYHZSizFxjNGcgVvoy8/VECue/fKPoeMK5dpSd5MRBeXr1L4NrYfJeVC2GY dV7BXQnwW+PlSgXzkF7p8tisMrG7nEPzJs9rCoVCdwAc5USu1JC3EcN7zNe2O10Th5LPLtRBHdSNV WmMZ5UOysyHtK5AAoG8mBxcVrLlo/+ztL2lJRKhYu6TBJLJ+UMWa/W37q9hn805rSa/TRLwJZuL4D O5YbBBSkoHNiVcefZlfCQsKsghrzF92/fQbbXJDCD6irsg9OKiBcppviNcVG8Qh0NZHAB4FSfStGE t23oCDzQ==; Received: from [192.168.2.1] (port=42546 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1q7JED-000UaF-39; Thu, 08 Jun 2023 18:15:18 +0100 From: Arun Isaac Date: Thu, 8 Jun 2023 18:14:50 +0100 Message-Id: <20230608171453.14788-1-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * mumi/client.scm (serialize-email-address): New function. (reply-email-headers): Use serialize-email-address. * tests/client.scm (serialize-email-address): New variable. ("serialize email address", "serialize email address with comma in name"): New tests. --- mumi/client.scm | 14 ++++++++++---- tests/client.scm | 11 +++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/mumi/client.scm b/mumi/client.scm index 64ccbeb..c30429d 100644 --- a/mumi/client.scm +++ b/mumi/client.scm @@ -221,6 +221,14 @@ arguments." (unless (zero? (close-pipe port)) (error "Command invocation failed" command)))))))) +(define (serialize-email-address name address) + "Combine NAME and ADDRESS into a complete email address of the form +\"NAME
\". Double quote NAME if necessary." + (string-append (if (string-contains name ",") + (string-append "\"" name "\"") + name) + " <" address ">")) + (define* (git-send-email to patches #:optional (options '())) "Send PATCHES using git send-email to the TO address with @@ -269,10 +277,8 @@ ISSUE-NUMBER." ,@(match (delete-duplicates (map (lambda (message) (let ((from (assoc-ref message "from"))) - (string-append (if (string-contains (assoc-ref from "name") ",") - (string-append "\"" (assoc-ref from "name") "\"") - (assoc-ref from "name")) - " <" (assoc-ref from "address") ">"))) + (serialize-email-address (assoc-ref from "name") + (assoc-ref from "address")))) (vector->list (assoc-ref issue "messages")))) (() (list)) (cc (list (cons 'cc (string-join cc ", ")))))))) diff --git a/tests/client.scm b/tests/client.scm index 5352b08..2b2c1be 100644 --- a/tests/client.scm +++ b/tests/client.scm @@ -65,8 +65,19 @@ called with." (lambda _ (error "Do not poll server for issue number")))) +(define serialize-email-address + (@@ (mumi client) serialize-email-address)) + (test-begin "client") +(test-equal "serialize email address" + "Foo " + (serialize-email-address "Foo" "foo@example.com")) + +(test-equal "serialize email address with comma in name" + "\"Bar, Foo\" " + (serialize-email-address "Bar, Foo" "foobar@example.com")) + (test-equal "send patches to new issue" '(("git" "send-email" "--to=foo@patches.com" "foo.patch") ("git" "send-email" "--to=12345@example.com" "bar.patch" "foobar.patch")) From patchwork Thu Jun 8 17:14:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Isaac X-Patchwork-Id: 50772 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F06AA27BBE9; Thu, 8 Jun 2023 18:16:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1BBAB27BBEC for ; Thu, 8 Jun 2023 18:16:40 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7JF0-0003TM-6c; Thu, 08 Jun 2023 13:16:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7JEx-0003Re-F6 for guix-patches@gnu.org; Thu, 08 Jun 2023 13:16:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7JEx-0007iz-5m for guix-patches@gnu.org; Thu, 08 Jun 2023 13:16:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7JEw-0008Oy-1H; Thu, 08 Jun 2023 13:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63802] [PATCH 2/3] client: Add git-send-email-headers subcommand. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: arunisaac@systemreboot.net, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 08 Jun 2023 17:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63802@debbugs.gnu.org Cc: Arun Isaac , Arun Isaac , Maxim Cournoyer X-Debbugs-Original-Xcc: Arun Isaac , Maxim Cournoyer Received: via spool by 63802-submit@debbugs.gnu.org id=B63802.168624452832238 (code B ref 63802); Thu, 08 Jun 2023 17:16:01 +0000 Received: (at 63802) by debbugs.gnu.org; 8 Jun 2023 17:15:28 +0000 Received: from localhost ([127.0.0.1]:57430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7JEN-0008Nr-TR for submit@debbugs.gnu.org; Thu, 08 Jun 2023 13:15:28 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:53342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7JEK-0008NS-9x for 63802@debbugs.gnu.org; Thu, 08 Jun 2023 13:15:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TxIsWRb933kbMKt20ovYCT1l+gLthf3NXnuRFqR0Wx8=; b=KxX/2Kh+zHWkqwukMUPHKez07t 9jTGCEL8PsXtaqJC+wUuHqp5ufL53KFiNEHPdmsc4kOcq5DWxe4l2Ed4xkSYNOq27ShOXWQSO6Bj/ 5XoMyfIPjOZuwEAPhw+yRI2JCSXFHr5PGPa+lTRVK14OGf0LhDO7xNuER10r5rOmojlpw7p0tVpY7 z/aw2xzCYcS5LRfHpP8z5dNr8mb5wwRXOzxwedPkG3weTb9mex9pisdeU4nf35wYwMYkBV9xwvYN2 dF0mvYKjoCzfHEs+AQhtck79Z4uyCf7kMrFcqbjDppJwfP7c8g9c6vAlMj8/fqSIVSI0HU7MUCu8g 8L8VWBQg==; Received: from [192.168.2.1] (port=42546 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1q7JEG-000UaF-2L; Thu, 08 Jun 2023 18:15:21 +0100 From: Arun Isaac Date: Thu, 8 Jun 2023 18:14:51 +0100 Message-Id: <20230608171453.14788-2-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230608171453.14788-1-arunisaac@systemreboot.net> References: <20230608171453.14788-1-arunisaac@systemreboot.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * mumi/client.scm: Import (rnrs exceptions). (git-send-email-headers): New public function. (split-cc): New function. * scripts/mumi.in: Add git-send-email-headers subcommand. * tests/client.scm (split-cc): New variable. ("split Cc field"): New test. --- mumi/client.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++++- scripts/mumi.in | 2 ++ tests/client.scm | 8 ++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/mumi/client.scm b/mumi/client.scm index c30429d..b89e608 100644 --- a/mumi/client.scm +++ b/mumi/client.scm @@ -17,6 +17,7 @@ ;;; along with mumi. If not, see . (define-module (mumi client) + #:use-module (rnrs exceptions) #:use-module (rnrs io ports) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) @@ -38,7 +39,9 @@ print-current-issue set-current-issue! clear-current-issue! - send-email)) + send-email + git-send-email-headers + compose)) (define (git-top-level) "Return the top-level directory of the current git repository." @@ -229,6 +232,13 @@ arguments." name) " <" address ">")) +(define (split-cc cc) + "Split CC into a list of email addresses." + (map (lambda (address) + (serialize-email-address (assq-ref address 'name) + (assq-ref address 'address))) + (assq-ref (parse-email-headers (string-append "Cc: " cc "\n")) + 'cc))) (define* (git-send-email to patches #:optional (options '())) "Send PATCHES using git send-email to the TO address with @@ -311,3 +321,43 @@ ISSUE-NUMBER." "@" (client-config 'debbugs-host)) other-patches))))) + +(define (git-send-email-headers patch) + "Print send-email headers for PATCH." + (let* (;; Compute headers if configured in git config. + (header-command + (guard (ex (#t #f)) + (call-with-input-pipe* (list "git" "config" "sendemail.headerCmd") + get-line))) + (headers + (if header-command + (call-with-input-pipe (string-append header-command " " patch) + get-string-all) + "")) + (external-x-debbugs-cc + (cond + ((assq-ref (parse-email-headers (string-append headers "\n")) + 'x-debbugs-cc) + => split-cc) + (else '()))) + ;; Fetch Cc addresses for current issue. + (x-debbugs-cc + (cond + ((assq-ref (reply-email-headers (current-issue-number)) + 'cc) + => split-cc) + (else '())))) + ;; Print X-Debbugs-Cc header. + (display "X-Debbugs-Cc: ") + (display (string-join (delete-duplicates + (append x-debbugs-cc external-x-debbugs-cc)) + ", ")) + (newline) + ;; Print headers other than X-Debbugs-Cc. + ;; TODO: RFC5322 headers are not restricted to a single + ;; line. "Folded" multi-line headers are allowed. Support them. + (for-each (lambda (line) + (unless (string-prefix-ci? "X-Debbugs-Cc:" line) + (display line) + (newline))) + (string-split headers #\newline)))) diff --git a/scripts/mumi.in b/scripts/mumi.in index 2295328..8fb7cd4 100644 --- a/scripts/mumi.in +++ b/scripts/mumi.in @@ -163,6 +163,8 @@ (client:clear-current-issue!)) (("send-email" . patches) (client:send-email patches)) + (("git-send-email-headers" patch) + (client:git-send-email-headers patch)) (("mailer" . rest) (let* ((opts (parse-options rest)) (sender (assoc-ref opts 'sender)) diff --git a/tests/client.scm b/tests/client.scm index 2b2c1be..ced573b 100644 --- a/tests/client.scm +++ b/tests/client.scm @@ -68,6 +68,9 @@ called with." (define serialize-email-address (@@ (mumi client) serialize-email-address)) +(define split-cc + (@@ (mumi client) split-cc)) + (test-begin "client") (test-equal "serialize email address" @@ -78,6 +81,11 @@ called with." "\"Bar, Foo\" " (serialize-email-address "Bar, Foo" "foobar@example.com")) +(test-equal "split Cc field" + (list "Foo " + "\"Bar, Foo\" ") + (split-cc "Foo , \"Bar, Foo\" ")) + (test-equal "send patches to new issue" '(("git" "send-email" "--to=foo@patches.com" "foo.patch") ("git" "send-email" "--to=12345@example.com" "bar.patch" "foobar.patch")) From patchwork Thu Jun 8 17:14:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Isaac X-Patchwork-Id: 50771 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1A6CF27BBEA; Thu, 8 Jun 2023 18:16:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D9A4127BBE2 for ; Thu, 8 Jun 2023 18:16:39 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7JF2-0003UD-R7; Thu, 08 Jun 2023 13:16:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7JEx-0003Rl-KA for guix-patches@gnu.org; Thu, 08 Jun 2023 13:16:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7JEx-0007j1-Bc for guix-patches@gnu.org; Thu, 08 Jun 2023 13:16:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7JEw-0008PS-TN; Thu, 08 Jun 2023 13:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63802] [PATCH 3/3] client: Use mumi git-send-email-headers subcommand. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: arunisaac@systemreboot.net, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 08 Jun 2023 17:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63802@debbugs.gnu.org Cc: Arun Isaac , Arun Isaac , Maxim Cournoyer X-Debbugs-Original-Xcc: Arun Isaac , Maxim Cournoyer Received: via spool by 63802-submit@debbugs.gnu.org id=B63802.168624453132253 (code B ref 63802); Thu, 08 Jun 2023 17:16:02 +0000 Received: (at 63802) by debbugs.gnu.org; 8 Jun 2023 17:15:31 +0000 Received: from localhost ([127.0.0.1]:57434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7JEQ-0008O9-QJ for submit@debbugs.gnu.org; Thu, 08 Jun 2023 13:15:31 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:53350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7JEM-0008NZ-MW for 63802@debbugs.gnu.org; Thu, 08 Jun 2023 13:15:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BlHu1DbWh0/7hHaMnRwnNVITcHXrUy8CcqxuzBbAH98=; b=p71JYVPGZSnMh/ceryS2s+aqWI dZbgAget+elAjfBe45d9KUNHpP8NdLanRsrReXXE6JiGBUEMZIq8VGH2KbDmGHM1vok4xRfmM7ujN +1tmtpylLxZOiVEWI4XPhqhw8HwQnGOQWg20re+RP/tsyJzHOQ0FPxRLuA1usrOIlifI/1ZeIGlob Ry7IeeyfCOF85Me5k3zjrB8AkxmGMkTIsst9hSvrQaaUQrtIIaG6AC7WVSNudhr7KGaeWkulE1htb nbPoSgqITSfvIZmeqYh7tznqGHGdQ1ubVJbwm2gfjkqshqXw8riqQSBAh0P951LtyetMlVWcTCxnH xeW5N1RA==; Received: from [192.168.2.1] (port=42546 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1q7JEJ-000UaF-1Z; Thu, 08 Jun 2023 18:15:24 +0100 From: Arun Isaac Date: Thu, 8 Jun 2023 18:14:52 +0100 Message-Id: <20230608171453.14788-3-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230608171453.14788-1-arunisaac@systemreboot.net> References: <20230608171453.14788-1-arunisaac@systemreboot.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 b89e608..1fe9d2c 100644 --- a/mumi/client.scm +++ b/mumi/client.scm @@ -293,8 +293,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. @@ -302,7 +303,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 ced573b..d28bc1a 100644 --- a/tests/client.scm +++ b/tests/client.scm @@ -99,10 +99,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*) @@ -114,6 +117,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" @@ -127,10 +131,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*) @@ -142,10 +149,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*) @@ -157,6 +167,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")