From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id eHuXEC5JfWRrBQAASxT56A (envelope-from ) for ; Mon, 05 Jun 2023 04:32:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GMyhEC5JfWTpWAEA9RJhRA (envelope-from ) for ; Mon, 05 Jun 2023 04:32:14 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8BEAB190B1 for ; Mon, 5 Jun 2023 04:32:13 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q600p-0004D1-7s; Sun, 04 Jun 2023 22:32:03 -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 1q600o-0004Ct-8O for guix-patches@gnu.org; Sun, 04 Jun 2023 22:32:02 -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 1q600o-0007Qb-0J for guix-patches@gnu.org; Sun, 04 Jun 2023 22:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q600n-0000wA-Ip for guix-patches@gnu.org; Sun, 04 Jun 2023 22:32:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63802] [mumi PATCH 2/3] client: Add git-send-email-headers subcommand. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 05 Jun 2023 02:32: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: Arun Isaac Cc: 63802@debbugs.gnu.org Received: via spool by 63802-submit@debbugs.gnu.org id=B63802.16859323143590 (code B ref 63802); Mon, 05 Jun 2023 02:32:01 +0000 Received: (at 63802) by debbugs.gnu.org; 5 Jun 2023 02:31:54 +0000 Received: from localhost ([127.0.0.1]:47625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q600g-0000vp-3i for submit@debbugs.gnu.org; Sun, 04 Jun 2023 22:31:54 -0400 Received: from mail-qv1-f53.google.com ([209.85.219.53]:47591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q600d-0000vb-Ld for 63802@debbugs.gnu.org; Sun, 04 Jun 2023 22:31:52 -0400 Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-6259c242c96so36846426d6.3 for <63802@debbugs.gnu.org>; Sun, 04 Jun 2023 19:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685932305; x=1688524305; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=kYeyn4uzFNWcU4c+AeWsOYMIczYZOI1AjS8jT9s4GXA=; b=bKwexNKrke9v+NvK2GskMMyBnck0DKNP+IZQ6lZPwd64gGIwYfoKV3B+3nU6HaCQP9 yjpSfuQyw9XdHiZfkwtqVEYvgbii5LBldoq5nAmNbp+I2EYO9fiubSSLhHB+IyD1tyjR P05BthMlSKQngmRjQpxbDfZ+ujktmhj9i8IegvT7VFGkxz+hvsk3JWM4AWKMWJtTWXwX XwJNwGE0qNGO3gjOcrT8U90KiJanyfcyjz+VxpFDj6iRuDbvSCGvSSWvTQk0P9MepowS +G/UssYNS8+kyvGpOqcJoMOuydn6JiQsN+Me2UXKUjjyWrYwM4k+DQSVJ4uCjx/v60i/ OQzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685932305; x=1688524305; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kYeyn4uzFNWcU4c+AeWsOYMIczYZOI1AjS8jT9s4GXA=; b=kTf3LomXpX8JTR725fRrVG8zvG8YtwWthplTC9qTXUKUq3XIbyZBXaSd4NZkxcclef ojWA57mMg3cZsxiqrv8HKV8/H4HjHH9Q6dbg6hGyF+rg0ZBw7eBwdvs+o8ZQ1EFhiXRE omZk6L22NJDuXtXlZluoRGuyPCjw9S/pQfJe7+mI8Y70oIcUF+KD92UWhykLbjvpJbHs Ne+/RmuF4csbT5ogfktbpfqkL0/P3UK/vPh4qFZC16rq7IzTDdO2eDimk1fJtqpXpZV4 F3zN4/fMY0LvPBXg/1GrZ3IVGQkXcCyEvA/vxN4loYKd3JS8mPNKL9nFVurocRW9o8E4 KbnA== X-Gm-Message-State: AC+VfDz4iLuX1ZDyau12e2jg4jYJV1qhyRrWF1VGKocfNKyuh/JgtcSB FM9c0Q2O9ePi/NQxkylHr1AP2Vo1PbaQcQ== X-Google-Smtp-Source: ACHHUZ6W+7nS1kVbypRrwAI0zibF3Cud7xnmfE8i+NtL0elW2EO/sUpSQDnyKsFg8M+JsVWVd883PA== X-Received: by 2002:ad4:5c81:0:b0:625:aa1a:b6d3 with SMTP id o1-20020ad45c81000000b00625aa1ab6d3mr7781938qvh.53.1685932305522; Sun, 04 Jun 2023 19:31:45 -0700 (PDT) Received: from hurd (dsl-152-122.b2b2c.ca. [66.158.152.122]) by smtp.gmail.com with ESMTPSA id a5-20020a0ce905000000b0062618962ec0sm4000603qvo.133.2023.06.04.19.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 19:31:45 -0700 (PDT) From: Maxim Cournoyer References: <20230530121447.26236-1-arunisaac@systemreboot.net> <20230530121447.26236-2-arunisaac@systemreboot.net> Date: Sun, 04 Jun 2023 22:31:43 -0400 In-Reply-To: <20230530121447.26236-2-arunisaac@systemreboot.net> (Arun Isaac's message of "Tue, 30 May 2023 13:14:46 +0100") Message-ID: <87ttvmd4hc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1685932334; a=rsa-sha256; cv=none; b=t6AVseMLnZn7jRkZz4Tvgaz0mvWLVlj0hYVN2eueBuaNPQ03V/UDMy6RiW12mLEYSQfuYV XPKBnBvQxnzJOa+he1RsHzO4WBgmjYyuhLPO1qHxfAWVNl3r9NaFCjFcOHyQRp8psMoAdq gRjoJ6zrZ90IJSayV9ghyhMuT3GzhLUhuOEL3SCnPaGZTxG1NnsX99x7rR/4JM6E+1g4zV FRSUb0X751R0B5DdtBahIeY7NzDCl0zaEcdAZf0FIctIszTsg1ktBYB2eNu0/glzMopV7y YTpievmWsC7TvXuM4rVaj6EPywcZnJ2acbO5tkPxxZMd4XtJhSg2aHmPr+xDRQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=bKwexNKr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685932334; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=kYeyn4uzFNWcU4c+AeWsOYMIczYZOI1AjS8jT9s4GXA=; b=G+U5+9bGQpuomte+GoPHVEe9xH8/Mn4VJxHTefuhF86S3fGKGcD0nUGyHqOiOMhLs4x13X fiJOLRKKn6f7sLpVo6ZhatJVd3OSUYLYmcw48WMVpVY74GAg2r+lByhAASo+U6KJR5MAZ6 FNuzvi13N1b8PLYIzMioEf6Do0DsMJDxl54hiCbmIuXydk1NdwRjDmbdFj/GWkjItXMEzv NwG1GhyHrdasVJtjvOkQtUlNVx0V/PZdM+YyZjQn1VhhL1Q8g/S/Cbk8Xw5gqaVuuvXdFm 8N4BgE4by7JVVGFj85YqVMc5Z50TFD0FTJS1FQ1oxXQ8bynSPu1EA/VU/Eiwsg== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=bKwexNKr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -2.19 X-Spam-Score: -2.19 X-Migadu-Queue-Id: 8BEAB190B1 X-TUID: x7jn/jzunjec Hi Arun, Arun Isaac writes: > * mumi/client.scm: Import (rnrs exceptions). > (git-send-email-headers): New public function. > * scripts/mumi.in: Add git-send-email-headers subcommand. > --- > mumi/client.scm | 42 +++++++++++++++++++++++++++++++++++++++++- > scripts/mumi.in | 2 ++ > 2 files changed, 43 insertions(+), 1 deletion(-) > > diff --git a/mumi/client.scm b/mumi/client.scm > index 5befd42..c70fe61 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." > @@ -306,3 +309,40 @@ 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 > + (assq-ref (parse-email-headers > + (string-append (string-trim-right headers #\newline) > + "\n")) > + 'x-debbugs-cc)) > + ;; Fetch Cc addresses for current issue. > + (x-debbugs-cc > + (assq-ref (reply-email-headers (current-issue-number)) > + 'cc))) > + ;; Print X-Debbugs-Cc header. > + (when (or x-debbugs-cc external-x-debbugs-cc) > + (display "X-Debbugs-Cc: ") > + (display (if (and x-debbugs-cc external-x-debbugs-cc) > + (string-append x-debbugs-cc ", " external-x-debbugs-cc) > + (or x-debbugs-cc external-x-debbugs-cc))) I find the or/if/and/or mix here a bit dense to parse. I think it'd be a cleaner and easier to follow to process external-x-debbugs-cc and x-debbug-cc into a list of values (potentially '()), merge then, deduplicate them, and finally string-join them back before displaying the combined value. What do you think? -- Thanks, Maxim