Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
* [PATCH] ty: say in the body when only part of a series was applied
@ 2026-11-28 20:37 Keith Busch
  0 siblings, 0 replies; only message in thread
From: Keith Busch @ 2026-11-28 20:37 UTC (permalink / raw)
  To: tools, konstantin; +Cc: Keith Busch

From: Keith Busch <kbusch@kernel.org>

A partial pickup only marks its thank-you with "(subset)" in the
subject. Threaded mail views often show just the first subject of a
thread, so the contributor can miss that the other patches were not
taken.

Add a ${subset} template variable that holds a line saying so for a
partial pickup and is empty otherwise, and use it in the default and
example templates.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 src/b4/templates/thanks-am-template.example |  4 +++-
 src/b4/ty.py                                |  5 ++++-
 src/tests/test_ty.py                        | 16 ++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/b4/templates/thanks-am-template.example b/src/b4/templates/thanks-am-template.example
index b38131b..dd65949 100644
--- a/src/b4/templates/thanks-am-template.example
+++ b/src/b4/templates/thanks-am-template.example
@@ -23,7 +23,9 @@ ${quote}
 #   b4-check-repo = https://git.kernel.org/pub/scm/linux/kernel/git/uname/sound.git
 #   b4-commit-url-mask = https://git.kernel.org/uname/sound/c/%.8s
 Applied to ${branch}, thanks!
-
+# When only some patches of a series were applied, ${subset} adds a line
+# saying so; otherwise it is empty. Keep it on a line of its own.
+${subset}
 # for patch series, the summary is a list of each patch with a link
 # to the commit id in your tree. b4 builds these links itself for trees
 # on git.kernel.org, github.com and gitlab.com; for other hosts, set
diff --git a/src/b4/ty.py b/src/b4/ty.py
index 85de47d..9fa15f6 100644
--- a/src/b4/ty.py
+++ b/src/b4/ty.py
@@ -48,7 +48,7 @@ On ${sentdate}, ${fromname} wrote:
 ${quote}
 
 Applied, thanks!
-
+${subset}
 ${summary}
 
 Best regards,
@@ -136,8 +136,11 @@ def make_reply(
     subject = re.sub(r'^Re:\s+', '', jsondata['subject'], flags=re.I)
     if jsondata.get('cherrypick'):
         msg.add_header('Subject', 'Re: (subset) ' + subject)
+        # Threaded views often show only the first subject, so say it in the body too
+        jsondata['subset'] = 'Partial patchset pickup: only the patches listed below were applied.\n'
     else:
         msg.add_header('Subject', 'Re: ' + subject)
+        jsondata['subset'] = ''
 
     msg['Message-Id'] = b4.make_msgid(idstring='b4-ty', allow_custom_msgid_cmd=True)
     msg['Date'] = email.utils.formatdate(localtime=True)
diff --git a/src/tests/test_ty.py b/src/tests/test_ty.py
index f429cb1..d897af9 100644
--- a/src/tests/test_ty.py
+++ b/src/tests/test_ty.py
@@ -837,6 +837,22 @@ def test_make_reply_me_too_never_keeps_us_as_addressee() -> None:
     assert tos == ['list@example.com', 'Test@example.com']
 
 
+@pytest.mark.parametrize('cherrypick', [True, False])
+def test_make_reply_subset(cherrypick: bool) -> None:
+    """A partial pickup says so in the body, not only in the subject."""
+    jsondata = _am_jsondata('0123456789abcdef0123456789abcdef01234567')
+    jsondata['cherrypick'] = cherrypick
+    cmdargs = mock.Mock(metoo=False, since=None)
+    msg = b4.ty.make_reply('Applied!\n${subset}\n', jsondata, None, cmdargs)
+    body = msg.get_payload(decode=True).decode()
+    if cherrypick:
+        assert msg['Subject'] == 'Re: (subset) [PATCH] frobnicate'
+        assert body == 'Applied!\nPartial patchset pickup: only the patches listed below were applied.\n\n'
+    else:
+        assert msg['Subject'] == 'Re: [PATCH] frobnicate'
+        assert body == 'Applied!\n\n'
+
+
 def test_queue_message_check_headers(
     monkeypatch: pytest.MonkeyPatch, tmp_path: pathlib.Path
 ) -> None:
-- 
2.52.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-28 20:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 20:37 [PATCH] ty: say in the body when only part of a series was applied Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox