diff mbox

[U-Boot] patman: Add --thread option

Message ID 1452721181-14240-1-git-send-email-mateusz.kulikowski@gmail.com
State Superseded
Headers show

Commit Message

Mateusz Kulikowski Jan. 13, 2016, 9:39 p.m. UTC
Add option to create threaded series of patches.
With it, it will be possible to create patch threads like this:
[PATCH 0/10] Add support for time travel
  [PATCH 1/10] Add Flux Capacitor driver
  [PATCH 2/10] Add Mr. Fusion driver
  (...)

Internally it will call git send-email with --thread option

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---

 tools/patman/gitutil.py | 6 +++++-
 tools/patman/patman.py  | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Simon Glass Jan. 14, 2016, 5:17 p.m. UTC | #1
Hi Mateusz,

On 13 January 2016 at 14:39, Mateusz Kulikowski
<mateusz.kulikowski@gmail.com> wrote:
> Add option to create threaded series of patches.
> With it, it will be possible to create patch threads like this:
> [PATCH 0/10] Add support for time travel
>   [PATCH 1/10] Add Flux Capacitor driver
>   [PATCH 2/10] Add Mr. Fusion driver
>   (...)
>
> Internally it will call git send-email with --thread option
>
> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> ---
>
>  tools/patman/gitutil.py | 6 +++++-
>  tools/patman/patman.py  | 4 +++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
> index 9e739d8..5f1b4f6 100644
> --- a/tools/patman/gitutil.py
> +++ b/tools/patman/gitutil.py
> @@ -328,7 +328,7 @@ def BuildEmailList(in_list, tag=None, alias=None, raise_on_error=True):
>      return result
>
>  def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
> -        self_only=False, alias=None, in_reply_to=None):
> +        self_only=False, alias=None, in_reply_to=None, thread=False):
>      """Email a patch series.
>
>      Args:
> @@ -342,6 +342,8 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
>          self_only: True to just email to yourself as a test
>          in_reply_to: If set we'll pass this to git as --in-reply-to.
>              Should be a message ID that this is in reply to.
> +        thread: True to add --thread to git send-email (make
> +            all patches reply to cover-letter or first patch in series)
>
>      Returns:
>          Git command that was/would be run
> @@ -400,6 +402,8 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
>      cmd = ['git', 'send-email', '--annotate']
>      if in_reply_to:
>          cmd.append('--in-reply-to="%s"' % in_reply_to)
> +    if thread:
> +        cmd.append('--thread')
>
>      cmd += to
>      cmd += cc
> diff --git a/tools/patman/patman.py b/tools/patman/patman.py
> index 6fe8fe0..57ae8f3 100755
> --- a/tools/patman/patman.py
> +++ b/tools/patman/patman.py
> @@ -61,6 +61,8 @@ parser.add_option('--no-check', action='store_false', dest='check_patch',
>                    help="Don't check for patch compliance")
>  parser.add_option('--no-tags', action='store_false', dest='process_tags',
>                    default=True, help="Don't process subject tags as aliaes")
> +parser.add_option('--thread', action='store_true', dest='thread',
> +                  default=False, help='Create patches as a single thread')

Can we have -T as well as --thread? Faster to type.

>
>  parser.usage += """
>
> @@ -161,7 +163,7 @@ else:
>      if its_a_go:
>          cmd = gitutil.EmailPatches(series, cover_fname, args,
>                  options.dry_run, not options.ignore_bad_tags, cc_file,
> -                in_reply_to=options.in_reply_to)
> +                in_reply_to=options.in_reply_to, thread=options.thread)
>      else:
>          print col.Color(col.RED, "Not sending emails due to errors/warnings")
>
> --
> 2.5.0
>

Regards,
Simon
diff mbox

Patch

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 9e739d8..5f1b4f6 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -328,7 +328,7 @@  def BuildEmailList(in_list, tag=None, alias=None, raise_on_error=True):
     return result
 
 def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
-        self_only=False, alias=None, in_reply_to=None):
+        self_only=False, alias=None, in_reply_to=None, thread=False):
     """Email a patch series.
 
     Args:
@@ -342,6 +342,8 @@  def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
         self_only: True to just email to yourself as a test
         in_reply_to: If set we'll pass this to git as --in-reply-to.
             Should be a message ID that this is in reply to.
+        thread: True to add --thread to git send-email (make
+            all patches reply to cover-letter or first patch in series)
 
     Returns:
         Git command that was/would be run
@@ -400,6 +402,8 @@  def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
     cmd = ['git', 'send-email', '--annotate']
     if in_reply_to:
         cmd.append('--in-reply-to="%s"' % in_reply_to)
+    if thread:
+        cmd.append('--thread')
 
     cmd += to
     cmd += cc
diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index 6fe8fe0..57ae8f3 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -61,6 +61,8 @@  parser.add_option('--no-check', action='store_false', dest='check_patch',
                   help="Don't check for patch compliance")
 parser.add_option('--no-tags', action='store_false', dest='process_tags',
                   default=True, help="Don't process subject tags as aliaes")
+parser.add_option('--thread', action='store_true', dest='thread',
+                  default=False, help='Create patches as a single thread')
 
 parser.usage += """
 
@@ -161,7 +163,7 @@  else:
     if its_a_go:
         cmd = gitutil.EmailPatches(series, cover_fname, args,
                 options.dry_run, not options.ignore_bad_tags, cc_file,
-                in_reply_to=options.in_reply_to)
+                in_reply_to=options.in_reply_to, thread=options.thread)
     else:
         print col.Color(col.RED, "Not sending emails due to errors/warnings")