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>
Subject: [PATCH b4 1/3] ez: allow iterations to be sent in a single thread
Date: Tue, 21 Feb 2023 20:29:17 -0500	[thread overview]
Message-ID: <20230219-send-iterations-in-same-thread-v1-1-59b802382eb5@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 optional argument to get_prep_branch_as_patches, 'samethread',
defaulting to False. 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.

This functionality will be exposed to users in a following commit.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 b4/ez.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/b4/ez.py b/b4/ez.py
index 74afddc..dac5e2a 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1117,7 +1117,8 @@ def get_mailfrom() -> Tuple[str, str]:
     return usercfg.get('name'), usercfg.get('email')
 
 
-def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtracking: bool = True
+def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtracking: bool = True,
+                               samethread: bool = False
                                ) -> Tuple[List, List, str, List[Tuple[str, email.message.Message]]]:
     cover, tracking = load_cover(strip_comments=True)
 
@@ -1191,6 +1192,12 @@ def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtr
     if addtracking:
         patches[0][1].add_header('X-B4-Tracking', thdata)
 
+    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
 

-- 
2.34.1


  reply	other threads:[~2023-02-22  1:29 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 ` Philippe Blain [this message]
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 ` [PATCH b4 v2] " Philippe Blain
2023-02-27 21:35 ` [PATCH b4 0/3] " 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-v1-1-59b802382eb5@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.