Good practices for applying/working with patch series in email based workflows?

Hi crafters,

I recently started to improve my own workflow when it comes to applying larger patch series sent by email to my local guix repository (which is useful to use and test patches sent to guixes bugs/patches list).

Right now, I’m using a self-written “apply a patch from my local maildir to the current buffer” (that uses completing-read for navigating my maildir) elisp function which does work well for singular patches, but not too well for large-ish patch series.

I do know that things like b4 (b4 0.12.3 — Packages — GNU Guix) exist; but am not too familiar with it. So I wonder what you folks are doing in these regards or if any of you know a way to comfortably apply a patch series from debbugs to a local guix repository?

Cheers!

Honestly, this is something I have not really spent the necessary time to figure out and be comfortable with. The patch-driven e-mail workflow is simple in theory but can be confusing in practice!

Would you be willing to share your function/script so that others could try it out? It sounds really useful!

Would you be willing to share your function/script so that others could try it out? It sounds really useful!

Sure thing! I’ll probably improve them a bit first and maybe add support for patch series/multiple selected mails as well (right now you would have to select each email containing a patch singularly) and then share it here this weekend.

What I’d also love to do would be to figure out how debbugs.el interacts with debbugs to open patchsets in Gnus and use that knowledge, to write an elisp function where you could query debbugs for the patch set you want & then use magit-am-apply-$something on the entire set to apply it on a local guix repo.

1 Like

That would be really useful!

I just read on the guix-devel mailing list this morning that b4 has a guix-specific config when called from inside the local guix repository, so I decided to read up on the manual how b4 works and share my findings here.

So far, there’s b4 mbox msgid to fetch threads/patch series by passing a message-ID to it:

(guix230 (~/devel/guix)) λ guix shell b4 -- b4 mbox cover.1707234911.git.w@wmeyer.eu
Looking up https://yhetil.org/guix/cover.1707234911.git.w@wmeyer.eu
Grabbing thread from yhetil.org/guix/cover.1707234911.git.w@wmeyer.eu/t.mbox.gz
4 messages in the thread
Saved ./cover.1707234911.git.w@wmeyer.eu.mbx

and there’s b4 shazam to fetch and apply patch sets (it takes -vN as an argument, if you want to use a specific version of a patch-sets if there are multiple):

(guix230 (~/devel/guix)) λ guix shell b4 -- b4 shazam cover.1707234911.git.w@wmeyer.eu
Looking up https://yhetil.org/guix/cover.1707234911.git.w@wmeyer.eu
Grabbing thread from yhetil.org/guix/cover.1707234911.git.w@wmeyer.eu/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Nothing matching that query.
Analyzing 4 messages in the thread
---
  [PATCH 1/3] gnu: linux-libre 6.7: Update to 6.7.4.
  [PATCH 2/3] gnu: linux-libre 6.6: Update to 6.6.16.
  [PATCH 3/3] gnu: linux-libre 6.1: Update to 6.1.77.
---
Total patches: 3
---
 Base: using specified base-commit 5936a7447ce8275d515c9e5784eec8074bc09e10

this seems to be the most convenient way on the shell to apply patches/patch series.

My next step would be to figure out how to integrate that (maybe with debbugs.el) in emacs. Ideally, you’d be able to query debbugs for a patchset you want, select the fitting result using complete-read & apply it to your local repository.

I wonder if you could apply using notmuch or mu4e / maildir if this is what you use.

Outside emacs, I’ve seen Drew Devault videos on a new mail client centered on mail patching workflow. The original is no longer supported, but there is an active fork: aerc: A pretty good email client (fork of https://sr.ht/~sircmpwn/aerc)

1 Like

I just found a b4 / emacs integration package: piem - Emacs tools and glue for working with public-inbox archives

there is also https://sr.ht/~yoctocell/git-email/ to prepare patches

2 Likes