tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] b4: add an --apply option for b4 am
@ 2020-08-24 15:43 Josef Bacik
  2020-09-09 19:45 ` [tools] " Konstantin Ryabitsev
  0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2020-08-24 15:43 UTC (permalink / raw)
  To: tools, kernel-team

I'm infinitely lazy and would rather not have to copy and paste the git
am command to run.  This patch adds a --apply/-a option to git am so
it'll go ahead and run git am so I can get to the work of reviewing a
patch series.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 b4/command.py | 2 ++
 b4/mbox.py    | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/b4/command.py b/b4/command.py
index ffa58ef..c584fb0 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -113,6 +113,8 @@ def cmd():
                             '(tries to ensure that all index blobs exist by making a fake commit range)')
     sp_am.add_argument('--no-cover', dest='nocover', action='store_true', default=False,
                        help='Do not save the cover letter (on by default when using -o -)')
+    sp_am.add_argument('-a', '--apply', dest='apply', action='store_true', default=False,
+                       help='Run git am on the resulting am file')
     sp_am.set_defaults(func=cmd_am)
 
     # b4 attest
diff --git a/b4/mbox.py b/b4/mbox.py
index fb82389..0fd4795 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -239,7 +239,12 @@ def mbox_to_am(mboxfile, cmdargs):
         os.unlink(am_filename)
 
     thanks_record_am(lser, cherrypick=cherrypick)
-
+    if cmdargs.apply:
+        ecode, out = b4.git_run_command(None, ['am', am_filename])
+        if ecode > 0:
+            logger.critical("Error: couldn't apply patch cleanly")
+        else:
+            logger.critical("Applied patchfile cleanly")
 
 def thanks_record_am(lser, cherrypick=None):
     if not lser.complete:
-- 
2.24.1


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

end of thread, other threads:[~2020-09-10 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 15:43 [PATCH] b4: add an --apply option for b4 am Josef Bacik
2020-09-09 19:45 ` [tools] " Konstantin Ryabitsev
2020-09-10 14:33   ` Josef Bacik

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).