All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: "Kernel.org Tools" <tools@linux.kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Philippe Blain <levraiphilippeblain@gmail.com>
Subject: [PATCH b4 v2] ez: allow sending all versions of a patch series in the same thread
Date: Thu, 23 Feb 2023 20:14:21 -0500	[thread overview]
Message-ID: <20230219-send-iterations-in-same-thread-v2-1-3ae4ac504e07@gmail.com> (raw)
In-Reply-To: <20230219-send-iterations-in-same-thread-v1-0-59b802382eb5@gmail.com>

Some projects prefer further iterations of a patch series to be sent in
the same thread as previous ones. Usually this means that the cover
letter of v2 is sent as a reply to the cover letter of v1, etc.

Add a new config option for 'b4 send', 'send-same-thread', defaulting to
False, and read its value in get_prep_branch_as_patches. When True, add
an 'In-Reply-To' header to the first mail in the series, referencing the
Message-ID of the previous iterations's cover letter.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
Changes in v2:
- removed the command-line flag and kept only the config, as suggested
  by Konstantin
- Link to v1: https://msgid.link/20230219-send-iterations-in-same-thread-v1-0-59b802382eb5@gmail.com

v1:
Sending a new iteration of a series in the same thread as the previous
one is the preferred workflow on some lists, the Git mailing list being
an example [1].

This series allows that workflow in b4 by adding a '--same-thread'
option to 'b4 send', with an associated config option.

Cheers,

Philippe.

[1] https://git-scm.com/docs/MyFirstContribution#v2-git-send-email
---
 b4/ez.py        | 7 +++++++
 docs/config.rst | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/b4/ez.py b/b4/ez.py
index 74afddc..16e1cf8 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1191,6 +1191,13 @@ def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtr
     if addtracking:
         patches[0][1].add_header('X-B4-Tracking', thdata)
 
+    samethread = config.get('send-same-thread', '').lower() in {'yes', 'true', 'y'}
+    if samethread and revision > 1:
+        oldrev = revision - 1
+        voldrev =  f'v{oldrev}'
+        oldmsgid =  tracking['series']['history'][voldrev][-1]
+        patches[0][1].add_header('In-Reply-To', f'<{oldmsgid}>')
+
     tag_msg = f'{csubject.full_subject}\n\n{cover_letter}'
     return alltos, allccs, tag_msg, patches
 
diff --git a/docs/config.rst b/docs/config.rst
index b3ab5ca..a1c424c 100644
--- a/docs/config.rst
+++ b/docs/config.rst
@@ -351,6 +351,12 @@ Contributor-oriented settings
 
   Default:: ``scripts/get_maintainer.pl --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nom``
 
+``b4.send-same-thread`` (v0.13+)
+  When sending a new version of a series, make it part of the same
+  thread as the previous one. The first mail will be sent as a reply
+  to the previous version's cover letter.
+
+  Default: ``no``
 
 ``b4.prep-cover-strategy`` (v0.10+)
   Alternative cover letter storage strategy to use (see :ref:`prep_cover_strategies`).

---
base-commit: a3281834d6d5dec44f58071fca2d22e04a97fe18
change-id: 20230219-send-iterations-in-same-thread-c50a3bc4ed9e
--
b4 


  parent reply	other threads:[~2023-02-24  1:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  1:29 [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread Philippe Blain
2023-02-22  1:29 ` [PATCH b4 1/3] ez: allow iterations to be sent in a single thread Philippe Blain
2023-02-22  1:29 ` [PATCH b4 2/3] ez: add '--same-thread' option to 'b4 send' Philippe Blain
2023-02-22  1:29 ` [PATCH b4 3/3] ez: add 'b4.send-same-thread' config for 'b4 send --same-thread' Philippe Blain
2023-02-22  2:25 ` [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread Konstantin Ryabitsev
2023-02-22 17:52   ` Philippe Blain
2023-02-24  1:14 ` Philippe Blain [this message]
2023-02-27 21:35 ` Konstantin Ryabitsev
2023-02-27 21:37   ` Konstantin Ryabitsev

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=20230219-send-iterations-in-same-thread-v2-1-3ae4ac504e07@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.