* [PATCH v2] shazam: Add the --merge-base argument
@ 2023-02-01 17:33 Conor Dooley
2023-02-01 20:24 ` Konstantin Ryabitsev
0 siblings, 1 reply; 4+ messages in thread
From: Conor Dooley @ 2023-02-01 17:33 UTC (permalink / raw)
To: palmer, konstantin; +Cc: conor, Palmer Dabbelt, tools, Conor Dooley
From: Palmer Dabbelt <palmer@rivosinc.com>
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>
Co-developed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
Been running this fixed up version for a bit now with no issues. Dunno
if the last submission didn't end up in an inbox for some reason, but
figured I'd resend with my fixes.
The changelog is the diff I attached in my response to the v1:
https://lore.kernel.org/tools/Y8199aCGNIW37YGx@spud/T/#m9fbe4c02429ec0601e5ff93fbe1aaecb368f736c
---
b4/command.py | 2 ++
b4/mbox.py | 17 +++++++++++------
man/b4.5.rst | 2 ++
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/b4/command.py b/b4/command.py
index 304450f..3d769ad 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -175,6 +175,8 @@ def setup_parser() -> argparse.ArgumentParser:
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 e0c6a0a..0b0fc40 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -211,14 +211,17 @@ def make_am(msgs: List[email.message.Message], cmdargs: argparse.Namespace, msgi
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:
+ 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 base_commit and topdir:
# Does it actually exist in this tree?
@@ -670,8 +673,8 @@ def refetch(dest: str) -> None:
def main(cmdargs: argparse.Namespace) -> None:
+ # We force some settings
if cmdargs.subcmd == 'shazam':
- # We force some settings
cmdargs.checknewer = True
cmdargs.threeway = False
cmdargs.nopartialreroll = False
@@ -683,6 +686,8 @@ def main(cmdargs: argparse.Namespace) -> None:
cmdargs.guessbase = True
else:
cmdargs.guessbase = False
+ else:
+ cmdargs.mergebase = False
if cmdargs.checknewer:
# Force nocache mode
diff --git a/man/b4.5.rst b/man/b4.5.rst
index dc00ef2..31beae4 100644
--- a/man/b4.5.rst
+++ b/man/b4.5.rst
@@ -230,6 +230,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.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] shazam: Add the --merge-base argument
2023-02-01 17:33 [PATCH v2] shazam: Add the --merge-base argument Conor Dooley
@ 2023-02-01 20:24 ` Konstantin Ryabitsev
2023-02-02 18:16 ` Conor Dooley
0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Ryabitsev @ 2023-02-01 20:24 UTC (permalink / raw)
To: palmer, Conor Dooley; +Cc: Palmer Dabbelt, tools, Conor Dooley
On Wed, 01 Feb 2023 17:33:02 +0000, Conor Dooley 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.
>
> [...]
Applied, thanks!
[1/1] shazam: Add the --merge-base argument
commit: 7e797fe9e052bbc97f4ee2cf14b3c444c2d01653
Best regards,
--
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] shazam: Add the --merge-base argument
2023-02-01 20:24 ` Konstantin Ryabitsev
@ 2023-02-02 18:16 ` Conor Dooley
2023-02-03 2:58 ` Palmer Dabbelt
0 siblings, 1 reply; 4+ messages in thread
From: Conor Dooley @ 2023-02-02 18:16 UTC (permalink / raw)
To: Konstantin Ryabitsev; +Cc: palmer, Palmer Dabbelt, tools, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
On Wed, Feb 01, 2023 at 03:24:05PM -0500, Konstantin Ryabitsev wrote:
>
> On Wed, 01 Feb 2023 17:33:02 +0000, Conor Dooley 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.
> >
> > [...]
>
> Applied, thanks!
>
> [1/1] shazam: Add the --merge-base argument
> commit: 7e797fe9e052bbc97f4ee2cf14b3c444c2d01653
Great, thanks Konstantin!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] shazam: Add the --merge-base argument
2023-02-02 18:16 ` Conor Dooley
@ 2023-02-03 2:58 ` Palmer Dabbelt
0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2023-02-03 2:58 UTC (permalink / raw)
To: Conor Dooley; +Cc: konstantin, tools, Conor Dooley
On Thu, 02 Feb 2023 10:16:25 PST (-0800), Conor Dooley wrote:
> On Wed, Feb 01, 2023 at 03:24:05PM -0500, Konstantin Ryabitsev wrote:
>>
>> On Wed, 01 Feb 2023 17:33:02 +0000, Conor Dooley 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.
>> >
>> > [...]
>>
>> Applied, thanks!
>>
>> [1/1] shazam: Add the --merge-base argument
>> commit: 7e797fe9e052bbc97f4ee2cf14b3c444c2d01653
>
> Great, thanks Konstantin!
Ya, thanks for sorting this out guys. I think I've got a few more
patches floating around, I haven't poked my tree for a bit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-03 2:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-01 17:33 [PATCH v2] shazam: Add the --merge-base argument Conor Dooley
2023-02-01 20:24 ` Konstantin Ryabitsev
2023-02-02 18:16 ` Conor Dooley
2023-02-03 2:58 ` Palmer Dabbelt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.