diff options
author | Philippe Blain <levraiphilippeblain@gmail.com> | 2023-02-23 20:14:21 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-02-27 16:35:02 -0500 |
commit | 14a6165754778b83cdfb0b546f5bf23cecb84744 (patch) | |
tree | ebe96b4900040f780dbc75e16f023e7328d66ae5 | |
parent | 8e59593f24e24f7ba6bb0de0fa498b0e32b946ad (diff) | |
download | b4-14a6165754778b83cdfb0b546f5bf23cecb84744.tar.gz |
ez: allow sending all versions of a patch series in the same thread
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>
Link: https://msgid.link/20230219-send-iterations-in-same-thread-v2-1-3ae4ac504e07@gmail.com
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/ez.py | 11 | ||||
-rw-r--r-- | docs/config.rst | 6 |
2 files changed, 17 insertions, 0 deletions
@@ -1192,6 +1192,17 @@ 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}' + try: + oldmsgid = tracking['series']['history'][voldrev][-1] + patches[0][1].add_header('In-Reply-To', f'<{oldmsgid}>') + patches[0][1].add_header('References', f'<{oldmsgid}>') + except (KeyError, IndexError): + logger.debug('Could not find previous series msgid, skipping %s', voldrev) + 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 caa6e38..389badf 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -363,6 +363,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`). |