From: Conor Dooley <conor@kernel.org>
To: Palmer Dabbelt <palmer@rivosinc.com>, konstantin@linuxfoundation.org
Cc: tools@linux.kernel.org
Subject: Re: [PATCH] shazam: Add the --merge-base argument
Date: Fri, 20 Jan 2023 22:34:01 +0000 [thread overview]
Message-ID: <Y8sW2QoSQk08315M@spud> (raw)
In-Reply-To: <20221013175727.17139-1-palmer@rivosinc.com>
[-- Attachment #1: Type: text/plain, Size: 3824 bytes --]
Hey Konstantin,
On Thu, Oct 13, 2022 at 10:57:27AM -0700, Palmer Dabbelt wrote:
> 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/
I guess this just got lost somewhere (missing a CC?), or perhaps we've
missed some reason why this is not needed?
Doesn't apply cleanly against 0.12.0, but with -3 it does & appears to
work - at least in my simple test cases
For example, the following gets automagically assigned -rc4 as a base:
/stuff/b4/b4.sh shazam -s -t shazam 20230119094447.21939-3-walker.chen@starfivetech.com -H
But I don't want to merge -rc4 into my for-next branch, and being able
to explicitly pass my preferred base of -rc1 is really useful.
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Thanks,
Conor.
> 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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-01-20 22:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 17:57 [PATCH] shazam: Add the --merge-base argument Palmer Dabbelt
2023-01-20 22:34 ` Conor Dooley [this message]
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=Y8sW2QoSQk08315M@spud \
--to=conor@kernel.org \
--cc=konstantin@linuxfoundation.org \
--cc=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