discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
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	[thread overview]
Message-ID: <20210523062651.4513-1-kyle@kyleam.com> (raw)
In-Reply-To: <87fsyearuu.fsf@kyleam.com>

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))))
 
 \f
@@ -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


      reply	other threads:[~2021-05-23  6:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-23  6:26 upcoming changes in b4 v0.7.0 Kyle Meyer
2021-05-23  6:26 ` Kyle Meyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210523062651.4513-1-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    --subject='Re: [PATCH] b4: Call git-am with --format=mbox when b4 handles download' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.kyleam.com/piem/

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).