@@ -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
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(-)