diff mbox series

pwclient: support 'git am -m'

Message ID 157971403528.598176.7190574914928843930.stgit@bahia.lan
State Accepted
Headers show
Series pwclient: support 'git am -m' | expand

Commit Message

Greg Kurz Jan. 22, 2020, 5:31 p.m. UTC
A new '--msgid' argument is added that causes pwclient to call
'git am -m' and thus add the Message-ID header to the commit
message. This is a recommended practice in some projects like
QEMU for example.

This can also be controlled from the .pwclientrc file, like
'--signoff' and '--3way'.

Signed-off-by: Greg Kurz <groug@kaod.org>
---

Hi,

This is a patch against the master branch of pwclient repo at:

https://github.com/getpatchwork/pwclient.git

If it should be submitted some other way, please advice.

Cheers,

--
Greg

 docs/configuration.rst |    4 ++++
 pwclient/parser.py     |    3 +++
 pwclient/shell.py      |   11 +++++++++++
 3 files changed, 18 insertions(+)

Comments

Stephen Finucane Feb. 1, 2020, 12:49 p.m. UTC | #1
On Wed, 2020-01-22 at 18:31 +0100, Greg Kurz wrote:
> A new '--msgid' argument is added that causes pwclient to call
> 'git am -m' and thus add the Message-ID header to the commit
> message. This is a recommended practice in some projects like
> QEMU for example.
> 
> This can also be controlled from the .pwclientrc file, like
> '--signoff' and '--3way'.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

I need to get pwclient set up as a subproject on Patchwork but haven't
gotten around to it yet. I've applied this and cut pwclient 1.2.
Thanks!

Stephen

> ---
> 
> Hi,
> 
> This is a patch against the master branch of pwclient repo at:
> 
> https://github.com/getpatchwork/pwclient.git
> 
> If it should be submitted some other way, please advice.
> 
> Cheers,
> 
> --
> Greg
diff mbox series

Patch

diff --git a/docs/configuration.rst b/docs/configuration.rst
index 3d57208be846..4f56b91c8f06 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -32,6 +32,10 @@  The ``options`` section provides the following configuration options:
   Enable three-way merge when applying patches using the :command:`git-am`
   command. Defaults to ``False``.
 
+``msgid``
+  Add a ``Message-Id:`` line to commit messages when applying patches using
+  the :command:`git-am` command. Defaults to ``False``.
+
 The names of the project sections must correspond to the project names in
 Patchwork, as reflected in the project's URL in Patchwork. Multiple projects
 can be defined, but no two projects can share the same name. Project sections
diff --git a/pwclient/parser.py b/pwclient/parser.py
index a1e27a4ffbb9..dc3934a89ed5 100644
--- a/pwclient/parser.py
+++ b/pwclient/parser.py
@@ -91,6 +91,9 @@  installed locales.
     git_am_parser.add_argument(
         '-3', '--3way', action='store_true', dest='three_way',
         help="pass '--3way' to 'git-am'")
+    git_am_parser.add_argument(
+        '-m', '--msgid', action='store_true', dest='msg_id',
+        help="pass '--message-id' to 'git-am'")
     git_am_parser.set_defaults(subcmd='git_am')
 
     get_parser = subparsers.add_parser(
diff --git a/pwclient/shell.py b/pwclient/shell.py
index 5ecaed32eabe..1f127ead9ebb 100644
--- a/pwclient/shell.py
+++ b/pwclient/shell.py
@@ -177,6 +177,17 @@  def main(argv=sys.argv[1:]):
         if do_three_way:
             cmd.append('-3')
 
+        do_msg_id = None
+        if args.msg_id:
+            do_msg_id = args.msg_id
+        elif config.has_option('options', 'msgid'):
+            do_msg_id = config.getboolean('options', 'msgid')
+        elif config.has_option(project_str, 'msgid'):
+            do_msg_id = config.getboolean(project_str, 'msgid')
+
+        if do_msg_id:
+            cmd.append('-m')
+
         for patch_id in patch_ids:
             ret = patches.action_apply(rpc, patch_id, cmd)
             if ret: