Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@meta.com>
To: <tools@kernel.org>, <konstantin@linuxfoundation.org>
Cc: Keith Busch <kbusch@kernel.org>
Subject: [PATCH] ty: say in the body when only part of a series was applied
Date: Sat, 28 Nov 2026 12:37:18 -0800	[thread overview]
Message-ID: <20261128203718.662862-1-kbusch@meta.com> (raw)

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


                 reply	other threads:[~2026-11-28 20:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128203718.662862-1-kbusch@meta.com \
    --to=kbusch@meta.com \
    --cc=kbusch@kernel.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox