tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread
@ 2023-02-22  1:29 Philippe Blain
  2023-02-22  1:29 ` [PATCH b4 1/3] ez: allow iterations to be sent in a single thread Philippe Blain
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Philippe Blain @ 2023-02-22  1:29 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev

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

---
Philippe Blain (3):
      ez: allow iterations to be sent in a single thread
      ez: add '--same-thread' option to 'b4 send'
      ez: add 'b4.send-same-thread' config for 'b4 send --same-thread'

 b4/command.py             |  2 ++
 b4/ez.py                  | 14 ++++++++++++--
 docs/config.rst           |  4 ++++
 docs/contributor/send.rst |  5 +++++
 4 files changed, 23 insertions(+), 2 deletions(-)
---
base-commit: a3281834d6d5dec44f58071fca2d22e04a97fe18
change-id: 20230219-send-iterations-in-same-thread-c50a3bc4ed9e
--
b4 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH b4 1/3] ez: allow iterations to be sent in a single thread
  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
  2023-02-22  1:29 ` [PATCH b4 2/3] ez: add '--same-thread' option to 'b4 send' Philippe Blain
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Blain @ 2023-02-22  1:29 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH b4 2/3] ez: add '--same-thread' option to 'b4 send'
  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 ` 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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Blain @ 2023-02-22  1:29 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev

The previous commit tweaked get_prep_branch_as_patches to optionnally
send further iterations of a patch series in the same thread as previous
ones.

Expose that functionality to the command line by adding a
'--same-thread' option (defaulting to False) to 'b4 send', and pass it
down to get_prep_branch_as_patches. Document the new feature.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 b4/command.py             | 2 ++
 b4/ez.py                  | 2 +-
 docs/contributor/send.rst | 5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/b4/command.py b/b4/command.py
index a7a5aa9..21f0d0d 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -323,6 +323,8 @@ def setup_parser() -> argparse.ArgumentParser:
                          help='Resend a previously sent version of the series')
     sp_send.add_argument('--no-sign', action='store_true', default=False,
                          help='Do not add the cryptographic attestation signature header')
+    sp_send.add_argument('--same-thread', action='store_true', default=False,
+                         help='Keep all versions in the same thread')
     ag_sendh = sp_send.add_argument_group('Web submission', 'Authenticate with the web submission endpoint')
     ag_sendh.add_argument('--web-auth-new', dest='auth_new', action='store_true', default=False,
                           help='Initiate a new web authentication request')
diff --git a/b4/ez.py b/b4/ez.py
index dac5e2a..4013f29 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1295,7 +1295,7 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
             sys.exit(1)
 
         try:
-            todests, ccdests, tag_msg, patches = get_prep_branch_as_patches()
+            todests, ccdests, tag_msg, patches = get_prep_branch_as_patches(samethread=cmdargs.same_thread)
         except RuntimeError as ex:
             logger.critical('CRITICAL: Failed to convert range to patches: %s', ex)
             sys.exit(1)
diff --git a/docs/contributor/send.rst b/docs/contributor/send.rst
index bff67aa..6abceac 100644
--- a/docs/contributor/send.rst
+++ b/docs/contributor/send.rst
@@ -233,6 +233,11 @@ Command line flags
 ``--not-me-too``
   Removes your own email address from the recipients.
 
+``--same-thread``
+  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.
+
 ``--no-sign``
   Don't sign your patches with your configured attestation mechanism.
   Note, that patch signing is required for the web submission endpoint,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH b4 3/3] ez: add 'b4.send-same-thread' config for 'b4 send --same-thread'
  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 ` 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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Blain @ 2023-02-22  1:29 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev

Allow the default for the '--same-thread' option of 'b4 send' to be set
in b4's config by adding a 'b4.send-same-thread' configuration option.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 b4/ez.py        | 5 ++++-
 docs/config.rst | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/b4/ez.py b/b4/ez.py
index 4013f29..f0861ed 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1295,7 +1295,10 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
             sys.exit(1)
 
         try:
-            todests, ccdests, tag_msg, patches = get_prep_branch_as_patches(samethread=cmdargs.same_thread)
+            samethread = config.get('send-same-thread', '').lower() in {'yes', 'true', 'y'}
+            if cmdargs.same_thread or samethread:
+                samethread = True
+            todests, ccdests, tag_msg, patches = get_prep_branch_as_patches(samethread=samethread)
         except RuntimeError as ex:
             logger.critical('CRITICAL: Failed to convert range to patches: %s', ex)
             sys.exit(1)
diff --git a/docs/config.rst b/docs/config.rst
index b3ab5ca..0fd68c5 100644
--- a/docs/config.rst
+++ b/docs/config.rst
@@ -351,6 +351,10 @@ Contributor-oriented settings
 
   Default:: ``scripts/get_maintainer.pl --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nom``
 
+``b4.send-same-thread`` (v0.13+)
+  Send all versions of a patch series as part of the same thread.
+
+  Default: ``no``
 
 ``b4.prep-cover-strategy`` (v0.10+)
   Alternative cover letter storage strategy to use (see :ref:`prep_cover_strategies`).

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread
  2023-02-22  1:29 [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread Philippe Blain
                   ` (2 preceding siblings ...)
  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 ` 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
  5 siblings, 1 reply; 9+ messages in thread
From: Konstantin Ryabitsev @ 2023-02-22  2:25 UTC (permalink / raw)
  To: Philippe Blain; +Cc: Kernel.org Tools

On Tue, Feb 21, 2023 at 08:29:16PM -0500, Philippe Blain wrote:
> 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.

Thanks, Philippe.

I think I prefer to *just* have this be set in config, without the CLI switch.
The goal is to make "b4 prep" workflow be friendly to newbies, so having
--help output a ton of options is the situation I want to avoid.

I'll take this in if you drop the --same-thread switch.

Cheers,
-K

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Blain @ 2023-02-22 17:52 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: Kernel.org Tools

Hi Konstantin,

Le 2023-02-21 à 21:25, Konstantin Ryabitsev a écrit :
> On Tue, Feb 21, 2023 at 08:29:16PM -0500, Philippe Blain wrote:
>> 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.
> 
> Thanks, Philippe.
> 
> I think I prefer to *just* have this be set in config, without the CLI switch.
> The goal is to make "b4 prep" workflow be friendly to newbies, so having
> --help output a ton of options is the situation I want to avoid.
> 
> I'll take this in if you drop the --same-thread switch.

Yeah, I agree this will usually be a "set it once for this project and forget"
kind of thing, so it makes sense for it to be only settable in the config.

I will do that for v2.

Thanks,

Philippe.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH b4 v2] ez: allow sending all versions of a patch series in the same thread
  2023-02-22  1:29 [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread Philippe Blain
                   ` (3 preceding siblings ...)
  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-24  1:14 ` Philippe Blain
  2023-02-27 21:35 ` [PATCH b4 0/3] " Konstantin Ryabitsev
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Blain @ 2023-02-24  1:14 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev, Philippe Blain

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 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread
  2023-02-22  1:29 [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread Philippe Blain
                   ` (4 preceding siblings ...)
  2023-02-24  1:14 ` [PATCH b4 v2] " Philippe Blain
@ 2023-02-27 21:35 ` Konstantin Ryabitsev
  2023-02-27 21:37   ` Konstantin Ryabitsev
  5 siblings, 1 reply; 9+ messages in thread
From: Konstantin Ryabitsev @ 2023-02-27 21:35 UTC (permalink / raw)
  To: Kernel.org Tools, Philippe Blain


On Tue, 21 Feb 2023 20:29:16 -0500, Philippe Blain wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] ez: allow sending all versions of a patch series in the same thread
      commit: 14a6165754778b83cdfb0b546f5bf23cecb84744

Best regards,
-- 
Konstantin Ryabitsev <konstantin@linuxfoundation.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH b4 0/3] ez: allow sending all versions of a patch series in the same thread
  2023-02-27 21:35 ` [PATCH b4 0/3] " Konstantin Ryabitsev
@ 2023-02-27 21:37   ` Konstantin Ryabitsev
  0 siblings, 0 replies; 9+ messages in thread
From: Konstantin Ryabitsev @ 2023-02-27 21:37 UTC (permalink / raw)
  To: Kernel.org Tools, Philippe Blain

On Mon, Feb 27, 2023 at 04:35:55PM -0500, Konstantin Ryabitsev wrote:
> > This series allows that workflow in b4 by adding a '--same-thread'
> > option to 'b4 send', with an associated config option.
> > 
> > [...]
> 
> Applied, thanks!
> 
> [1/1] ez: allow sending all versions of a patch series in the same thread
>       commit: 14a6165754778b83cdfb0b546f5bf23cecb84744

Hm... I found a bug in my own code. :) I took the v2 of the series, with
slight modifications (which is why auto-matching failed).

Anyway, v2 is in.

-K

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-02-27 21:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH b4 v2] " Philippe Blain
2023-02-27 21:35 ` [PATCH b4 0/3] " Konstantin Ryabitsev
2023-02-27 21:37   ` Konstantin Ryabitsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).