discussion and development of piem
 help / color / mirror / code / Atom feed
* upcoming changes in b4 v0.7.0
@ 2021-05-23  6:26 Kyle Meyer
  2021-05-23  6:26 ` [PATCH] b4: Call git-am with --format=mbox when b4 handles download Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Meyer @ 2021-05-23  6:26 UTC (permalink / raw)
  To: piem

It looks like b4 v0.7.0 will probably come out next week.

  https://lore.kernel.org/tools/20210521214453.rsslslzjarpeovl3@nitro.local/

The new features just add to a list of features to consider supporting,
but the fairly large rework to switch away from Python's mailbox.mbox
made me worried that piem-b4-am-from-mid would need adjustments.

After some light testing, though, things look okay.  Something like the
following patch should probably be applied once 1) 0.7.0 has been out
for a while and 2) piem documents a minimum b4 version.  Until then, I
think this patch is likely to do more harm than good, though in either
case the fallout is just From_ misquoting in commit messages.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] b4: Call git-am with --format=mbox when b4 handles download
  2021-05-23  6:26 upcoming changes in b4 v0.7.0 Kyle Meyer
@ 2021-05-23  6:26 ` Kyle Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2021-05-23  6:26 UTC (permalink / raw)
  To: piem

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-23  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-23  6:26 upcoming changes in b4 v0.7.0 Kyle Meyer
2021-05-23  6:26 ` [PATCH] b4: Call git-am with --format=mbox when b4 handles download Kyle Meyer

Code repositories for project(s) associated with this public 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).