From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:267::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id qPIUCrv1qWB0AgAAsNZ9tg (envelope-from ); Sun, 23 May 2021 06:27:07 +0000 Received: from out0.migadu.com ([2001:41d0:2:267::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gOcgMbb1qWDuJgAAbx9fmQ (envelope-from ); Sun, 23 May 2021 06:27:02 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1621751222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VRIHJdg2Xl5gxooxHDS2L0qr/Erzfq9kqFHl6lnaLhI=; b=Pnyc0AmVHq9OUl8nd1hReUijj8cl4HLrh8zz8wjYd7dN6wvR9wiPbgtmcAPYe80qlmA8UW QVw9QF8QwT4KHoQZfkSH/mUBKqeF9M28WDj324shQRviNOskuL9p2+cJKzfQuJQIWksi3g bwitx5+RV+JvxPMcK7V0Sn+EP0VRkF+jTMwz/VNG8F+FS9ToKSotMxDw4Tw5n9ymwTs+ba IapEoXwnYJxJuBUcQO3DE6VkzV9zFS1wUL+dD4kxNgG5rbVUaeWDp1m//RSL+ak2d0N9zg Ova4dHkzxUtbQe95Jvyyu1Hbal8t+dVBc3bf22n6/21MVT1Aq77Q8pMwuRVBAA== From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH] b4: Call git-am with --format=mbox when b4 handles download Date: Sun, 23 May 2021 02:26:51 -0400 Message-Id: <20210523062651.4513-1-kyle@kyleam.com> In-Reply-To: <87fsyearuu.fsf@kyleam.com> References: <87fsyearuu.fsf@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: ILuT5BLbRYKH Released versions of b4 use Python's mailbox.mbox to read and write mboxes. That writes in the mboxo format (i.e. quotes only From_ lines, but not >From_ lines). >From piem-b4-am-from-mid's point of view, this doesn't really matter. It passes mboxrd input to b4-am via --use-local, and the From_ lines in the output have the same level of escaping. This output is then passed to a git-am invocation that uses --patch-format=mboxrd. In the b4 release (0.7.0), the situation changes slightly. With 4950093c0 (Don't use mboxo for anything, 2021-05-18), b4 writes an mbox without any escaping, avoiding Python's mbox functionality for everything except the --use-local code path [*]. piem-b4-am-from-mid usually goes through --use-local but falls back to letting b4 do download the mbox if local generation fails _and_ downloading the mbox from the associated piem-inboxes URL fails. If this fallback is reached, call git-am with --patch-format=mbox. [*] Python's mbox functionality isn't used if the mbox is fed to --use-local-mbox via stdin, though. --- piem-b4.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/piem-b4.el b/piem-b4.el index f25a676..239c237 100644 --- a/piem-b4.el +++ b/piem-b4.el @@ -104,6 +104,7 @@ (defun piem-b4--get-am-files (mid coderepo args) (when clean-fn (funcall clean-fn)) (error "Expected mbox file does not exist: %s" mbox-am)) + (if local-mbox-p "mboxrd" "mbox") clean-fn)))) @@ -155,12 +156,12 @@ (defun piem-b4-am-from-mid (mid &optional args toggle-worktree) args))) (user-error "%s is incompatible with this command" badopt)) (pcase-let* ((coderepo (piem-inbox-coderepo-maybe-read)) - (`(,cover ,mbox-file ,clean-fn) + (`(,cover ,mbox-file ,format ,clean-fn) (piem-b4--get-am-files mid coderepo args)) (default-directory coderepo)) (unwind-protect (piem-am mbox-file - nil + format (with-temp-buffer (insert-file-contents (or cover mbox-file)) (piem-extract-mbox-info)) base-commit: 2333819ee6b632909ba7333eb61be1653f5d8203 -- 2.31.1