tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: tools@linux.kernel.org, kernel-team@fb.com
Subject: [PATCH] b4: add an --apply option for b4 am
Date: Mon, 24 Aug 2020 11:43:21 -0400	[thread overview]
Message-ID: <73e01862e01dc42fe853365e4babe1f9d8c2e839.1598283790.git.josef@toxicpanda.com> (raw)

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


             reply	other threads:[~2020-08-24 15:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 15:43 Josef Bacik [this message]
2020-09-09 19:45 ` [tools] [PATCH] b4: add an --apply option for b4 am Konstantin Ryabitsev
2020-09-10 14:33   ` Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73e01862e01dc42fe853365e4babe1f9d8c2e839.1598283790.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=tools@linux.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).