tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shazam: Add the --add-message-id argument
@ 2023-02-16 16:48 Palmer Dabbelt
  2023-02-27 18:48 ` Konstantin Ryabitsev
  0 siblings, 1 reply; 8+ messages in thread
From: Palmer Dabbelt @ 2023-02-16 16:48 UTC (permalink / raw)
  To: tools; +Cc: Palmer Dabbelt

Some projects (at least QEMU) want Message-ID headers instead of Link
headers.  I couldn't find an easy way to do that, so this just adds an
argument to shazam that mirrors "--add-link" but adds a MessageID
instead.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
Using a LoreTrailer for something that's not on Lore seems odd, but it
appears to work so I just went with it.
---
 b4/__init__.py | 6 +++++-
 b4/command.py  | 2 ++
 b4/mbox.py     | 2 +-
 man/b4.5.rst   | 2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/b4/__init__.py b/b4/__init__.py
index 4d5a6c9..5e5a5a3 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -519,7 +519,7 @@ class LoreSeries:
             self.add_extra_trailers(self.patches[0].followup_trailers)  # noqa
 
     def get_am_ready(self, noaddtrailers=False, covertrailers=False, addmysob=False, addlink=False,
-                     linkmask=None, cherrypick=None, copyccs=False, allowbadchars=False) -> List[email.message.Message]:
+                     linkmask=None, cherrypick=None, copyccs=False, allowbadchars=False, addmessageid=False) -> List[email.message.Message]:
 
         usercfg = get_user_config()
         config = get_main_config()
@@ -585,6 +585,10 @@ class LoreSeries:
                     lltr = LoreTrailer(name='Link', value=linkval)
                     extras.append(lltr)
 
+                if addmessageid:
+                    msgid = "<%s>" % (lmsg.msgid)
+                    extras.append(LoreTrailer(name='Message-ID', value=msgid))
+
                 if attsame and not attcrit:
                     if attmark:
                         logger.info('  %s %s', attmark, lmsg.get_am_subject())
diff --git a/b4/command.py b/b4/command.py
index e384031..7d73aa5 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -51,6 +51,8 @@ def cmd_am_common_opts(sp):
                     help='Add your own signed-off-by to every patch')
     sp.add_argument('-l', '--add-link', dest='addlink', action='store_true', default=False,
                     help='Add a Link: with message-id lookup URL to every patch')
+    sp.add_argument('-I', '--add-message-id', dest='addmessageid', action='store_true', default=False,
+                    help='Add a Message-ID: with message-id to every patch')
     sp.add_argument('-P', '--cherry-pick', dest='cherrypick', default=None,
                     help='Cherry-pick a subset of patches (e.g. "-P 1-2,4,6-", '
                          '"-P _" to use just the msgid specified, or '
diff --git a/b4/mbox.py b/b4/mbox.py
index 48b037a..0e988a8 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -101,7 +101,7 @@ def make_am(msgs: List[email.message.Message], cmdargs: argparse.Namespace, msgi
         am_msgs = lser.get_am_ready(noaddtrailers=cmdargs.noaddtrailers,
                                     covertrailers=covertrailers, addmysob=cmdargs.addmysob,
                                     addlink=cmdargs.addlink, linkmask=config['linkmask'], cherrypick=cherrypick,
-                                    copyccs=cmdargs.copyccs, allowbadchars=cmdargs.allowbadchars)
+                                    copyccs=cmdargs.copyccs, allowbadchars=cmdargs.allowbadchars, addmessageid=cmdargs.addmessageid)
     except KeyError:
         sys.exit(1)
 
diff --git a/man/b4.5.rst b/man/b4.5.rst
index 90db4d7..07d2692 100644
--- a/man/b4.5.rst
+++ b/man/b4.5.rst
@@ -155,6 +155,8 @@ options:
                         Add your own signed-off-by to every patch
   -l, --add-link
                         Add a Link: with message-id lookup URL to every patch
+  -I, --add-message-id
+                        Add a Message-ID: with message-id to every patch
   -P CHERRYPICK, --cherry-pick CHERRYPICK
                         Cherry-pick a subset of patches (e.g. "-P 1-2,4,6-", "-P _" to use just the msgid specified, or "-P *globbing*" to match on commit subject)
   --cc-trailers
-- 
2.39.1


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 16:48 [PATCH] shazam: Add the --add-message-id argument Palmer Dabbelt
2023-02-27 18:48 ` Konstantin Ryabitsev
2023-02-27 19:00   ` Palmer Dabbelt
2023-02-27 19:03     ` Konstantin Ryabitsev
2023-02-27 19:05       ` Palmer Dabbelt
2023-02-27 20:09         ` Konstantin Ryabitsev
2023-02-27 20:26           ` Palmer Dabbelt
2023-02-27 20:47             ` 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).