Next: , Previous: , Up: Applying patches   [Contents][Index]


3.2 Using b4 to apply patches

b4 is a command-line tool for interacting with public-inbox archives. While useful for public-inbox archives in general, it is written for Linux kernel development and focuses on the public-inbox archives hosted at https://lore.kernel.org.

It’s a fast moving target at the moment, but some of its current capabilities include

The second item is the focus for piem, though at least some degree of support for all of the above features will likely be added. The entry point to applying patches with b4 is the piem-b4-am transient. (See https://magit.vc/manual/transient/ for more information on using Transient.)

piem-b4-am offers the following actions:

a
M-x piem-b4-am-from-mid

Generate or download a thread’s mbox for the current buffer’s message ID, process it into an am-ready mbox with b4, and then feed it to git am called within an associated Git repository. If a message ID of the current buffer is not known (i.e. piem-mid returns nil), one is read from the caller. The caller is also queried for the branch name and base, as described for piem-am (see Applying patches contained in a message). And, as with piem-am, a worktree can be created by configuring piem-am-create-worktree to a non-nil value or by giving a prefix argument.

To generate the input thread, first any functions in piem-mid-to-thread-functions are tried. This allows for a thread to be retrieved from a local store (e.g., the Notmuch database). If that fails, try to download the thread from the piem-inboxes URL associated with the current buffer, provided the current buffer’s message ID matches the one piem-b4-am-from-mid was called with. As a last resort, call b4 am without a local mbox to let it download the thread according to its own configuration.

i
M-x piem-b4-am-ready-from-mid

Call b4 am with a given message ID. This differs from piem-b4-am-from-mid in that it is a direct wrapper around a command-line call to b4 am. The caller is always queried for the message ID, and the final product is an am-ready mbox. b4 is responsible for downloading the thread, so the caller must point b4’s configuration option b4.midmask to the appropriate public-inbox URL.

b
M-x piem-b4-am-ready-from-mbox

Like piem-b4-am-ready-from-mid, but process a local mbox rather than identifying the thread based on the specified message ID.


Next: Applying patches without a public-inbox archive, Previous: Applying patches contained in a message, Up: Applying patches   [Contents][Index]