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

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 for more information on using Transient.)

piem-b4-am offers the following actions:

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

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, the thread is downloaded from the public-inbox URL associated with the current buffer. Finally, if an inbox’s entry in piem-inboxes doesn’t specify a URL, b4 am is called without a local mbox, letting it download the thread according to its own configuration.

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.

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: , Previous: , Up: Applying patches   [Contents][Index]