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

* Re: [tools] [PATCH] b4: add an --apply option for b4 am
  2020-08-24 15:43 [PATCH] b4: add an --apply option for b4 am Josef Bacik
@ 2020-09-09 19:45 ` Konstantin Ryabitsev
  2020-09-10 14:33   ` Josef Bacik
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Ryabitsev @ 2020-09-09 19:45 UTC (permalink / raw)
  To: tools, josef; +Cc: kernel-team

On Mon, Aug 24, 2020 at 11:43:21AM -0400, Josef Bacik wrote:
> 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.

I've considered this many times, but I thus far prefer not to do it, as 
we generally try not to touch the developer's tree in order to avoid any 
potential badness.

The functionality you want can be easily achieved with "-o- | git am", 
so you can make sure to heed any error messages first without it, and 
then with it:

b4 am <msgid>
(perform the review)
b4 am <msgid> -s -l -o- | git am

Would you be willing to use that, or do you think we really need an 
--apply option?

-K

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

* Re: [tools] [PATCH] b4: add an --apply option for b4 am
  2020-09-09 19:45 ` [tools] " Konstantin Ryabitsev
@ 2020-09-10 14:33   ` Josef Bacik
  0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2020-09-10 14:33 UTC (permalink / raw)
  To: Konstantin Ryabitsev, tools; +Cc: kernel-team

On 9/9/20 3:45 PM, Konstantin Ryabitsev wrote:
> On Mon, Aug 24, 2020 at 11:43:21AM -0400, Josef Bacik wrote:
>> 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.
> 
> I've considered this many times, but I thus far prefer not to do it, as
> we generally try not to touch the developer's tree in order to avoid any
> potential badness.
> 
> The functionality you want can be easily achieved with "-o- | git am",
> so you can make sure to heed any error messages first without it, and
> then with it:
> 
> b4 am <msgid>
> (perform the review)
> b4 am <msgid> -s -l -o- | git am
> 
> Would you be willing to use that, or do you think we really need an
> --apply option?
> 

Yeah somehow I missed the "-o -" option, I'll just use that.  I primarily use b4 
for review, so I'm in a scratch branch specifically to apply+build+review the 
series I'm pulling, so I don't mind if b4 messes up my current git tree.  But 
this works just as well, thanks,

Josef

^ permalink raw reply	[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).