From: Palmer Dabbelt <palmer@rivosinc.com>
To: tools@linux.kernel.org
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Subject: [PATCH] shazam: Add the --merge-base argument
Date: Thu, 13 Oct 2022 10:57:27 -0700 [thread overview]
Message-ID: <20221013175727.17139-1-palmer@rivosinc.com> (raw)
I was just handling a patch set where the author used English to
describe the dependencies. They hadn't yet been merged at the time the
patch set was posted so I don't think there's really any way to make
sure the computers always understand the base, this just lets me quickly
override the automatic merge base detection when I run into something
non-canonical.
Link: https://lore.kernel.org/all/20220913061817.22564-1-zong.li@sifive.com/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
b4/command.py | 2 ++
b4/mbox.py | 13 ++++++++-----
man/b4.5.rst | 2 ++
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/b4/command.py b/b4/command.py
index b16043e..5bb674e 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -171,6 +171,8 @@ def cmd():
sp_sh.add_argument('--guess-lookback', dest='guessdays', type=int, default=21,
help=('(use with -H or -M) When guessing base, go back this many days from the patch date '
'(default: 3 weeks)'))
+ sp_sh.add_argument('--merge-base', dest='mergebase', type=str, default=None,
+ help=('(use with -H or -M) Force this base when merging'))
sp_sh.set_defaults(func=cmd_shazam)
# b4 pr
diff --git a/b4/mbox.py b/b4/mbox.py
index ff96a11..c1a0660 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -231,14 +231,17 @@ def make_am(msgs, cmdargs, msgid):
logger.critical(' Link: %s', linkurl)
base_commit = None
- matches = re.search(r'base-commit: .*?([\da-f]+)', first_body, re.MULTILINE)
- if matches:
- base_commit = matches.groups()[0]
+ if cmdargs.mergebase is not None:
+ base_commit = cmdargs.mergebase
else:
- # Try a more relaxed search
- matches = re.search(r'based on .*?([\da-f]{40})', first_body, re.MULTILINE)
+ matches = re.search(r'base-commit: .*?([\da-f]+)', first_body, re.MULTILINE)
if matches:
base_commit = matches.groups()[0]
+ else:
+ # Try a more relaxed search
+ matches = re.search(r'based on .*?([\da-f]{40})', first_body, re.MULTILINE)
+ if matches:
+ base_commit = matches.groups()[0]
if not base_commit and topdir and cmdargs.guessbase:
logger.critical(' Base: attempting to guess base-commit...')
diff --git a/man/b4.5.rst b/man/b4.5.rst
index 073f32a..e889542 100644
--- a/man/b4.5.rst
+++ b/man/b4.5.rst
@@ -226,6 +226,8 @@ options:
Attempt to merge series as if it were a pull request (execs git-merge)
--guess-lookback GUESSDAYS
(use with -H or -M) When guessing base, go back this many days from the patch date (default: 3 weeks)
+ --merge-base COMMIT
+ (use with -H or -M) Force this base when merging
*Example*: b4 shazam -H 20200313231252.64999-1-keescook@chromium.org
--
2.38.0
next reply other threads:[~2022-10-13 17:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 17:57 Palmer Dabbelt [this message]
2023-01-20 22:34 ` [PATCH] shazam: Add the --merge-base argument Conor Dooley
2023-01-21 17:18 ` Conor Dooley
2023-01-22 18:18 ` Conor Dooley
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=20221013175727.17139-1-palmer@rivosinc.com \
--to=palmer@rivosinc.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).