All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonin Godard <antonin.godard@bootlin.com>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH b4 2/2] prep: add creation-factor argument
Date: Tue, 04 Feb 2025 17:44:17 +0100	[thread overview]
Message-ID: <20250204-creation-factor-v1-2-9988d594a018@bootlin.com> (raw)
In-Reply-To: <20250204-creation-factor-v1-0-9988d594a018@bootlin.com>

Like the previous commit ("diff: add a creation factor argument"), make
it possible to pass a creation factor when using b4 prep --compare-to.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 src/b4/command.py | 2 ++
 src/b4/ez.py      | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/b4/command.py b/src/b4/command.py
index 0485196..d4a70fd 100644
--- a/src/b4/command.py
+++ b/src/b4/command.py
@@ -310,6 +310,8 @@ def setup_parser() -> argparse.ArgumentParser:
                          help='Additional prefixes to add to those already defined')
     sp_prep.add_argument('-C', '--no-cache', dest='nocache', action='store_true', default=False,
                          help='Do not use local cache when performing remote queries')
+    sp_prep.add_argument('--creation-factor', default=None, type=int,
+                         help='Creation factor integer passed to git range-diff')
 
     spp_g = sp_prep.add_mutually_exclusive_group()
     spp_g.add_argument('-p', '--format-patch', metavar='OUTPUT_DIR',
diff --git a/src/b4/ez.py b/src/b4/ez.py
index f381727..d76acae 100644
--- a/src/b4/ez.py
+++ b/src/b4/ez.py
@@ -2550,7 +2550,7 @@ def force_revision(forceto: int) -> None:
     store_cover(cover, tracking)
 
 
-def compare(compareto: str, execvp: bool = True) -> Union[str, None]:
+def compare(compareto: str, execvp: bool = True, creation_factor: int = None) -> Union[str, None]:
     cover, tracking = load_cover()
     # Try the new format first
     tagname, revision = get_sent_tagname(tracking['series']['change-id'], SENT_TAG_PREFIX, compareto)
@@ -2580,6 +2580,8 @@ def compare(compareto: str, execvp: bool = True) -> Union[str, None]:
     lines = b4.git_get_command_lines(None, gitargs)
     curr_end = lines[0]
     grdcmd = ['git', 'range-diff', '%.12s..%.12s' % (prev_start, prev_end), '%.12s..%.12s' % (curr_start, curr_end)]
+    if creation_factor:
+        grdcmd = grdcmd[:2] + [f"--creation-factor={creation_factor}"] + grdcmd[2:]
     logger.debug('Running %s', ' '.join(grdcmd))
     if execvp:
         # We exec range-diff and let it take over
@@ -2792,7 +2794,7 @@ def cmd_prep(cmdargs: argparse.Namespace) -> None:
         return format_patch(cmdargs.format_patch)
 
     if cmdargs.compare_to:
-        return compare(cmdargs.compare_to)
+        return compare(cmdargs.compare_to, creation_factor=cmdargs.creation_factor)
 
     if cmdargs.enroll_base and cmdargs.new_series_name:
         logger.critical('CRITICAL: -n NEW_SERIES_NAME and -e [ENROLL_BASE] can not be used together.')

-- 
2.47.0


  parent reply	other threads:[~2025-02-04 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 16:44 [PATCH b4 0/2] prep, diff: support overriding range-diff creation factor Antonin Godard
2025-02-04 16:44 ` [PATCH b4 1/2] diff: add a creation factor argument Antonin Godard
2025-02-04 16:44 ` Antonin Godard [this message]
2025-02-06 18:09 ` [PATCH b4 0/2] prep, diff: support overriding range-diff creation factor Konstantin Ryabitsev
2025-02-07  7:58   ` Antonin Godard

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=20250204-creation-factor-v1-2-9988d594a018@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tools@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 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.