summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-10-20 10:37:05 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-10-20 10:37:05 -0400
commit7c1d044ff1d5235e598d4c777c4abfe60e0a09a8 (patch)
tree36fe4dee81bd20ff900d5b022d11fd15ed55c241
parent6a212b5524903c170d420763c9c08a5444745281 (diff)
downloadb4-7c1d044ff1d5235e598d4c777c4abfe60e0a09a8.tar.gz
shazam: change default behaviour to be "apply-here"
Based on the feedback, change the default behaviour of "b4 shazam" to apply patches to the current tree instead of doing FETCH_HEAD magic. This is still available when used with -H,--make-fetch-head flag. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/command.py8
-rw-r--r--b4/mbox.py8
2 files changed, 9 insertions, 7 deletions
diff --git a/b4/command.py b/b4/command.py
index 9d364dd..9199359 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -35,6 +35,7 @@ def cmd_mbox_common_opts(sp):
sp.add_argument('-M', '--save-as-maildir', dest='maildir', action='store_true', default=False,
help='Save as maildir (avoids mbox format ambiguities)')
+
def cmd_am_common_opts(sp):
sp.add_argument('-v', '--use-version', dest='wantver', type=int, default=None,
help='Get a specific version of the patch/series')
@@ -147,10 +148,11 @@ def cmd():
sp_sh = subparsers.add_parser('shazam', help='Like b4 am, but applies the series to your tree')
cmd_retrieval_common_opts(sp_sh)
cmd_am_common_opts(sp_sh)
+ sp_sh.add_argument('-H', '--make-fetch-head', dest='makefetchhead', action='store_true', default=False,
+ help='Attempt to treat series as a pull request and fetch it into FETCH_HEAD')
sp_sh.add_argument('--guess-lookback', dest='guessdays', type=int, default=21,
- help = 'When guessing base, go back this many days from the patch date (default: 3 weeks)')
- sp_sh.add_argument('-A', '--apply-here', dest='applyhere', action='store_true', default=False,
- help = 'Apply to the current tree')
+ help=('(use with -H) When guessing base, go back this many days from the patch date '
+ '(default: 3 weeks)'))
sp_sh.set_defaults(func=cmd_shazam)
# b4 attest
diff --git a/b4/mbox.py b/b4/mbox.py
index 1b35623..9a673c7 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -262,7 +262,7 @@ def make_am(msgs, cmdargs, msgid):
ifh = io.StringIO()
b4.save_git_am_mbox(am_msgs, ifh)
ambytes = ifh.getvalue().encode()
- if cmdargs.applyhere:
+ if not cmdargs.makefetchhead:
amflags = config.get('git-am-flags', '')
sp = shlex.shlex(amflags, posix=True)
sp.whitespace_split = True
@@ -711,10 +711,10 @@ def main(cmdargs):
cmdargs.nopartialreroll = False
cmdargs.outdir = '-'
cmdargs.guessbranch = None
- if cmdargs.applyhere:
- cmdargs.guessbase = False
- else:
+ if cmdargs.makefetchhead:
cmdargs.guessbase = True
+ else:
+ cmdargs.guessbase = False
if cmdargs.checknewer:
# Force nocache mode