From patchwork Thu Feb 20 14:24:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonin Godard X-Patchwork-Id: 13984055 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 828141FAC5F for ; Thu, 20 Feb 2025 14:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740061512; cv=none; b=RpwqnWfJG472UiEw15VnCQ6tMeKGsDZgOuHnHtt2NFslB0qwf0U+KMekiJnBKj60faCwpDiG91rxNs7yQDYiB6DKmPb3isoim/WXZ0tPMsfRrlBufQYGHM3BDcMMz+UZPJbj3bSI2OsgMNo3+EmRP5Hk55fzjzoX9Npy6AfkXH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740061512; c=relaxed/simple; bh=6Q1tspBvwecRZLovSkVAAQZ4LeeFg+3iN1JmAldSi0U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EE/aQ48jLjzezTyixMU/tM1WqZMzkY64GkdrQLexYf3brEynnBMBs0v0E9yOIF6GcEQeDpvm/raevcEVeZIqkrULz5PAsIbIrEP2Q7sWzP+cpv2SHmqvLzj3MbbvKSuQBBB3NgIrxKxBvHZxVM3ZD9T/OvjePdb5Y5vFVAGd854= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VTYtoWNQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VTYtoWNQ" Received: by smtp.kernel.org (Postfix) id 2B920C4CEDD; Thu, 20 Feb 2025 14:25:12 +0000 (UTC) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 43795C4CED1 for ; Thu, 20 Feb 2025 14:25:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 43795C4CED1 Authentication-Results: smtp.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 48183433F8; Thu, 20 Feb 2025 14:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1740061502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=reTf09HCXsTnnPsoQy3+csOOvSGop1ndvmnOv+7j/JQ=; b=VTYtoWNQ9wvzQJLhpr/wF9QcaFG5cue2QqL7arOVASGV6vhlCvpYgy/XHFVNT0tul2vco2 ThnNJ24mlqrv3dB6bgBLZJL1u6XS+EhjETdVjUa/+J7ZCeESlJHZrqbzOQL+WdZHNam+0/ o/WCxjOcz5F5xGHTGuKfk4Wk/PwxKyH9pzxnWpwD7r4MWDv6FaVkOdgb6kXDe3Qziz0/0X XdVv6EMDAxOksLvW4DDiMJplLFJOj/uKWK9fZAkYwAwXjd15GrjSW0yn3F16lMU5y0mJos cx8y6wc9JP/vyC/anoGMQe/gAewW1PxFH1ddFyppb+Om/Fenmeit6c7PgWQSeg== From: Antonin Godard Date: Thu, 20 Feb 2025 15:24:57 +0100 Subject: [PATCH b4 v2 1/3] diff: add a creation factor argument Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250220-creation-factor-v2-1-7a0949a3a060@bootlin.com> References: <20250220-creation-factor-v2-0-7a0949a3a060@bootlin.com> In-Reply-To: <20250220-creation-factor-v2-0-7a0949a3a060@bootlin.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2805; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=6Q1tspBvwecRZLovSkVAAQZ4LeeFg+3iN1JmAldSi0U=; b=owEBbQKS/ZANAwAIAdGAQUApo6g2AcsmYgBntzs9r8QmaYZqkvA34XD7gUpwvxxg3POQO345V CogweOs30CJAjMEAAEIAB0WIQSGSHJRiN1AG7mg0//RgEFAKaOoNgUCZ7c7PQAKCRDRgEFAKaOo Nkk5D/4nAYmnBaCODa9mLEt3CB62RTJnmqaxgme+pufeD8gzHqTtxiiGFTtGOoWprWQxfVlAZks CdjwQRxQXm1mNTyXcwOawYBmu28FHLFeHgCwneBxalxhHu+DLD+RE3KYnS5JWo0stxoxzEi2mwz vnks0wID/ifdGOAmCxlV1aprCJ97OI/PnZDyIftyD/EY4iWH9w0ayyMHzehccpoI02FRPudDYNp C7vjrKW9iHLHgT6y2MRkLaslqttNMZ34/dOqn0PbJOiXHBPM9Trh2MDaKfQCxuTNy4Z2psGEX8M KrRtL7Wbaa0S1L1pTaNxsavJaQjCkvz7aDzKVN6JQyQHwgY5AtlUOgAPOl9jly9j5mwy4t15MbD A16YjZ+iKRg6uCZ7eiAGJ0FiBGUWeNHeCp8BFH8HhEuVk32FWZudXooO+4WVLdqcBL2HK6qWWwi WLDZ3Cj4exkYlqUvLa5eZnrHOTHudhPNiVNud1yIEhHEp650lBdFtpNe/m2gHJRni7YociWbNz7 y3WDp/KfgOP362e/3ciA2aXwx/konuo/HPY2UrkUK5QNlNMZzVI0XhKTW2wn8zK6auK1B1LtLSo Gdmre82mYG6cE+KEiSX9o/qer43uy/p9RSRWI0iwcIZyMe0kbOgtZysz4Dq84j/PwED+IrVuGKC swMBRq0PGB5TC+g== X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeijeefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeetnhhtohhnihhnucfiohgurghrugcuoegrnhhtohhnihhnrdhgohgurghrugessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepheeigeeuhfefgeehfffgueeiteehieelfeehjeektefgkeeuheeuleduvdelgffhnecukfhppedvrgdtvdemkeegvdekmeehfhgtudemiegttddumeeivdektdemkedthedtmeekfedvvgemvdehkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdgrtddvmeekgedvkeemhehftgdumeeitgdtudemiedvkedtmeektdehtdemkeefvdgvmedvheekgedphhgvlhhopegluddvjedrtddruddrudgnpdhmrghilhhfrhhomheprghnthhonhhinhdrghhouggrrhgusegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeegpdhrtghpthhtohepthhoohhlsheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghnthhonhhinhdrghhouggrrhgusegsohhothhlihhnrdgtohhmpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmp dhrtghpthhtohepkhhonhhsthgrnhhtihhnsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg X-GND-Sasl: antonin.godard@bootlin.com When using git range-diff it is possible to override the creation factor when git considers a large change a total rewrite (and so showing no diff at all), or a change so small it shouldn't be considered. This parameter is only possible to set from command-line, it has no global option associated to it within Git's config, so add a --creation-factor parameter to b4 to achieve the same behavior. Signed-off-by: Antonin Godard --- src/b4/command.py | 2 ++ src/b4/diff.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/b4/command.py b/src/b4/command.py index 2bdd785d90004bc0be9c839fe50938dc9cbbe207..1a9bd1c0b02181b432d535eee2fe0c4f510cf39b 100644 --- a/src/b4/command.py +++ b/src/b4/command.py @@ -287,6 +287,8 @@ def setup_parser() -> argparse.ArgumentParser: help='Force color output even when writing to file') sp_diff.add_argument('-m', '--compare-am-mboxes', dest='ambox', nargs=2, default=None, help='Compare two mbx files prepared with "b4 am"') + sp_diff.add_argument('--range-diff-opts', default=None, + help='Arguments passed to git range-diff') sp_diff.set_defaults(func=cmd_diff) # b4 kr diff --git a/src/b4/diff.py b/src/b4/diff.py index 1de3063ea0b3c73e4e3d8bfd4ec91b4c6f90cce6..0fe6e26d4e3a7a0fea4c7e14cabdfd366361968a 100644 --- a/src/b4/diff.py +++ b/src/b4/diff.py @@ -16,6 +16,7 @@ import email.parser import shutil import pathlib import argparse +import shlex from typing import Tuple, Optional, List @@ -156,7 +157,12 @@ def main(cmdargs: argparse.Namespace) -> None: logger.critical('---') logger.critical('Could not create fake-am range for upper series v%s', user.revision) sys.exit(1) - grdcmd = 'git range-diff %.12s..%.12s %.12s..%.12s' % (lsc, lec, usc, uec) + rd_opts = [] + if cmdargs.range_diff_opts: + sp = shlex.shlex(cmdargs.range_diff_opts, posix=True) + sp.whitespace_split = True + rd_opts = " ".join(list(sp)) + grdcmd = 'git range-diff %s %.12s..%.12s %.12s..%.12s' % (rd_opts, lsc, lec, usc, uec) if cmdargs.nodiff: logger.info('Success, to compare v%s and v%s:', lser.revision, user.revision) logger.info(f' {grdcmd}') @@ -167,6 +173,8 @@ def main(cmdargs: argparse.Namespace) -> None: gitargs = ['range-diff', f'{lsc}..{lec}', f'{usc}..{uec}'] if cmdargs.outdiff is None or cmdargs.color: gitargs.append('--color') + if rd_opts: + gitargs.append(rd_opts) ecode, rdiff = b4.git_run_command(cmdargs.gitdir, gitargs) if ecode > 0: logger.critical('Unable to generate diff') From patchwork Thu Feb 20 14:24:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonin Godard X-Patchwork-Id: 13984056 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DD4B1C174A for ; Thu, 20 Feb 2025 14:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740061513; cv=none; b=ARFfZnrTVMog1FhbP3O97L8C5S4VuaGY63BroCow+ujpfVrkmjGhPxCphaCmxvODC0mWc9OyoXcxuVscJaDDIp7xBul8hEnVot/q/pQ+OEhenJzv55svARp2Cv7Rq5hdfRrsq4yBykMHmO5oPK6w4sc0jwrxxNOAJrFE9hQiqpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740061513; c=relaxed/simple; bh=6C4fVJAQgARykHvPD+ihfdzuZvnAK4vrYJFgYwiFjAE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DCkpCb8+9Eb16jiWG9dcxT0kwRls98B0E5QMwl+zfeka70l7wFXhHnUolQiqN2fLMneVSZM7ldbGTNuZrP1ZHjPZkZmnH3dyEXekwwWgj8CeP0BxGXRMZT6VWw/cF1F/9KJTuHsnsjbGrIIkGFiKG3yQJDOFGkvG7RYdAlbkb1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=MoO4MBjW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="MoO4MBjW" Received: by smtp.kernel.org (Postfix) id D3158C4CEE9; Thu, 20 Feb 2025 14:25:12 +0000 (UTC) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 462EDC4CEE2 for ; Thu, 20 Feb 2025 14:25:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 462EDC4CEE2 Authentication-Results: smtp.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 8E7C0443EF; Thu, 20 Feb 2025 14:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1740061502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gSlxLgN30Y7fueWp/DdsPNb6pUSCb4DPwyawY5N3v7c=; b=MoO4MBjWH5hXE/Y+j+NAeodOobh5O0aV8S6SMyki8ut08Xt8Lj7fUbXPTSsIFFekRiwXp1 5NUGuGhebemVpV+3sbLoitavqF+xW4nY3CCwMrSNrzSwDCHJ470lL7o1snqirJLUbIebnk E9gQBrIfz8cpk3HkK49IzJsQl6L9i5LqITP2nMpITQPuU9kh8RCA56sv5thpake6lH9Hyu wWtBBYk8vzSWHgSck1w+bX+XMhjVWvh7zlGhPbXdK/M/mvskcOfUSaMmgGSA4I0g1nkKO/ 609cydRUU048gW5DWZzKC1Gm/w38x5PWwLeJ6j7GLUMXWWqNIEoJZiL+yH0XVg== From: Antonin Godard Date: Thu, 20 Feb 2025 15:24:58 +0100 Subject: [PATCH b4 v2 2/3] prep: add creation-factor argument Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250220-creation-factor-v2-2-7a0949a3a060@bootlin.com> References: <20250220-creation-factor-v2-0-7a0949a3a060@bootlin.com> In-Reply-To: <20250220-creation-factor-v2-0-7a0949a3a060@bootlin.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2858; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=6C4fVJAQgARykHvPD+ihfdzuZvnAK4vrYJFgYwiFjAE=; b=kA0DAAgB0YBBQCmjqDYByyZiAGe3Oz2if2azfHq+4x1FH1ZpSq0TjZROpCTOQz3s9vnypLr6U okCMwQAAQgAHRYhBIZIclGI3UAbuaDT/9GAQUApo6g2BQJntzs9AAoJENGAQUApo6g2EcsP/AoC UnkwL2NnZaVTIqOI6p6JerlkgrswLR+2WjAXpJJ+RYBWSbsz6LudbKCa7+a9eXWYO53/bM1d0UT be6jAriKMtxV+uea8GIPg7GHgkj3NYCycp1KRHH/hvCAxRXC/33u9BX8JUccxkv4LUk9FWDSK+P svatc3nzXp0XeOLE4/0R2cApSbVLSBUIPCT+R2mT2yAoyxGls1hQrmQRFb+mflZwqeWrOstLK7c Y7fRwa0TXUdyHDtgTVNRQqf2i0WKKlT3oewekY3e6qfM39d85bSFoh5iqfKM5SNaxus0Xak9lda NrlghBCdugZyvGXd6PWDWOTVvw9eLnVESwPbjnQAvAqHjPdbfa90xIUFYe4AVWRZfK5Je7bzqjv jQZk6aiOuaW5sigyhpjx611i9yKUFOwzWWjOZlJMUuysq3L/Q+M8LupxKCE5+DNXv+LEVj8oaS5 iti8aYj2QPaRowRmabiWGQ2hcZNnMjKidshvlVMUWYtTZBoOX/IyvrPU6kcnuo0o0swnUL9C/iY fJWWEIZvzKGW+LaTrLbEFMOeXelD30YE9JIG7No6egIG44zEt/PZX86dacmryt/7JD/sXxu9iC+ K0WiSaVDP9ws4FK9p2ihGffAeSeTs6Y5Thfbk6BI4qFnTxdntpYOmpj7Cd+cx7YUh+rzy12Sppn Z85oO X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeijeefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeetnhhtohhnihhnucfiohgurghrugcuoegrnhhtohhnihhnrdhgohgurghrugessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepheeigeeuhfefgeehfffgueeiteehieelfeehjeektefgkeeuheeuleduvdelgffhnecukfhppedvrgdtvdemkeegvdekmeehfhgtudemiegttddumeeivdektdemkedthedtmeekfedvvgemvdehkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdgrtddvmeekgedvkeemhehftgdumeeitgdtudemiedvkedtmeektdehtdemkeefvdgvmedvheekgedphhgvlhhopegluddvjedrtddruddrudgnpdhmrghilhhfrhhomheprghnthhonhhinhdrghhouggrrhgusegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeegpdhrtghpthhtohepthhoohhlsheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghnthhonhhinhdrghhouggrrhgusegsohhothhlihhnrdgtohhmpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmp dhrtghpthhtohepkhhonhhsthgrnhhtihhnsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg X-GND-Sasl: antonin.godard@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 --- src/b4/command.py | 2 ++ src/b4/ez.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/b4/command.py b/src/b4/command.py index 1a9bd1c0b02181b432d535eee2fe0c4f510cf39b..d1624c736195a1a1f023629afe06cf184c727098 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('--range-diff-opts', default=None, type=str, + help='Arguments passed to git range-diff when comparing series') 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 f381727d9bc6fe0d29328ef384647e3a6a23e767..d3dfea47a20a5622d2f8a349a731d25769e1a664 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, range_diff_opts: str = 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,11 @@ 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 range_diff_opts: + sp = shlex.shlex(range_diff_opts, posix=True) + sp.whitespace_split = True + rd_opts = list(sp) + grdcmd = grdcmd + rd_opts logger.debug('Running %s', ' '.join(grdcmd)) if execvp: # We exec range-diff and let it take over @@ -2792,7 +2797,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, range_diff_opts=cmdargs.range_diff_opts) 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.') From patchwork Thu Feb 20 14:24:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonin Godard X-Patchwork-Id: 13984057 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F12D71C174A for ; Thu, 20 Feb 2025 14:25:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740061514; cv=none; b=QAE1uSaxDewmlnV7exWWIi+I3A1VDuFhG5Q3peNhBKvTSQg6dxP73j987YaEjYiszzVktFDedI73LTAODcidDbvWNtP/GjG8khKiTDr2icctpp9vD/fIppuYNdCP0BdKjF3mTYSDj5g/d6ea91C441SLg+RpB6eptPnhsv70EBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740061514; c=relaxed/simple; bh=5BovhGgZtGTUA7lLH0pHxzJl4zqc0c3gon7W85QhURM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iwuqwA/O1uve7y7MMj2zBec/oP45LKJ50g2qE+afopH6m+WD1dQALUN2ZS/H2pLkoZbxcLSz+0ArWqW5oWvkgsr/es1kegM+y6be66hFLziR9ZAp03XDw6LoHHyAlxxaERWCqLIKJyljRZB2oEhrr/z5dMyScLQT16/T2QjqnKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=JUuywHgJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="JUuywHgJ" Received: by smtp.kernel.org (Postfix) id 7DBDEC4CED1; Thu, 20 Feb 2025 14:25:13 +0000 (UTC) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 48375C4CEE6 for ; Thu, 20 Feb 2025 14:25:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 48375C4CEE6 Authentication-Results: smtp.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id D03B5443F6; Thu, 20 Feb 2025 14:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1740061503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q9a1iVZA5tb+IdbzlCSD0ujKT15fFfeZUfSufYLuTkQ=; b=JUuywHgJqs62nP0Ca4OCWtVI9cvU49JfwKNNnAYFRrVZBPrYzWT7L1H8USoipuzK+9cZ2k Ca4/0FYtDxAmaJc50s6vKyZmqnO/qi7GtHa612t1ntUNOgRvZ2gt2YHBMSWEiG77SnIj6y QEL/JfsEJjlpqnKzOpTKB4Lh/xnjItJ2lANnRg4uJ01FM6o2q3Q55VisYmeF7Rm8EI3j8b 1igRapF0OgNH+MBdjllqqqjJqhhgF8oDeW1a2otGeRc6yzR/Wfiv+CLxqSy4g115aeNFX6 TD37yMstPPVkgiHH3jG6HBhwJToGaRvtxXLxpPnI4Zj31AF7wbygy/F6Gl5qOw== From: Antonin Godard Date: Thu, 20 Feb 2025 15:24:59 +0100 Subject: [PATCH b4 v2 3/3] prep, diff: document the --range-diff-opts option Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250220-creation-factor-v2-3-7a0949a3a060@bootlin.com> References: <20250220-creation-factor-v2-0-7a0949a3a060@bootlin.com> In-Reply-To: <20250220-creation-factor-v2-0-7a0949a3a060@bootlin.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1735; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=5BovhGgZtGTUA7lLH0pHxzJl4zqc0c3gon7W85QhURM=; b=owEBbQKS/ZANAwAIAdGAQUApo6g2AcsmYgBntzs90rEsdJkhaVJ5hdPASj73qnwfAY30dGvy1 vyGb8CreDyJAjMEAAEIAB0WIQSGSHJRiN1AG7mg0//RgEFAKaOoNgUCZ7c7PQAKCRDRgEFAKaOo NoldEACLS7ZpwYu3iIP7GcnN0iIDOxsrxSkCbl6WcM+N/ixb0KBkvZWnWB1L24qBeULVujP7jZQ HPadsgWi/ZaqHfVoiJBIidAhzh5zs8sfXdchn2iDV4azqf3R0GNYDGcMYMa5+Di9igjc2UcGQxw DGfrP4G/IjtsZlHFHLMr3nUqv0etIavUXkJwE/8hnCZw7OlHbBaqxzjekIZJWOBB1nXbivyFdsE jzuqrsLhXvMQ/rnQG8j8JhYdGk6KOg2QFbBNj0E06CoRN8BA0IL6t+FbKq+8RWyqrWqnDjP0IQB agvCe8wicznBgypBUqFLlKo5ESJsJB7mw5VDXCuUKlgOIQQvrl1gXm2xq6cuclGSfRzVUzv4woe zXCZenY3v+CoQC7z6LFRnznzr3rPLzPZxGOuuohF5vzoeX+jytaXeyfyug+7BFYDiJG57HwY5gL v8D/UhwN5VXC7Sj97039f+fmm5DDJIzpHh/gCMUuZa1cMpC/50DbMC12BXa91uFP2fD+2mSbFgC U3AxujLGjioauy/a9w4YHy7aBP3bLieS41cAhVxNglw7G8OjZDEWittIO/6dadmuRHuqsu17aMo 70YJ0d7jLYv4Bt5APdLFPTZ7xqOozd2kNJpoG+DaqveXkYctQiBy29HQhfk2nAwv8pk6HmpJV7h KuhwLiuoAFEdVWA== X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeijeefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeetnhhtohhnihhnucfiohgurghrugcuoegrnhhtohhnihhnrdhgohgurghrugessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepheeigeeuhfefgeehfffgueeiteehieelfeehjeektefgkeeuheeuleduvdelgffhnecukfhppedvrgdtvdemkeegvdekmeehfhgtudemiegttddumeeivdektdemkedthedtmeekfedvvgemvdehkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdgrtddvmeekgedvkeemhehftgdumeeitgdtudemiedvkedtmeektdehtdemkeefvdgvmedvheekgedphhgvlhhopegluddvjedrtddruddrudgnpdhmrghilhhfrhhomheprghnthhonhhinhdrghhouggrrhgusegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeegpdhrtghpthhtohepthhoohhlsheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghnthhonhhinhdrghhouggrrhgusegsohhothhlihhnrdgtohhmpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmp dhrtghpthhtohepkhhonhhsthgrnhhtihhnsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg X-GND-Sasl: antonin.godard@bootlin.com This argument allows adding options to `git range-diff`. Signed-off-by: Antonin Godard --- docs/contributor/prep.rst | 6 ++++++ docs/maintainer/diff.rst | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/docs/contributor/prep.rst b/docs/contributor/prep.rst index df8582426850df88b9e174e6429837e1eb49f792..18c710dd415794f5c1587b3375d86c8761c57602 100644 --- a/docs/contributor/prep.rst +++ b/docs/contributor/prep.rst @@ -494,3 +494,9 @@ modifying defaults for some of these flags. ``-e ENROLL_BASE, --enroll ENROLL_BASE`` Enrolls your current branch to be b4-prep managed. Requires the name of the branch to use as the fork-point tracking base. + +``--range-diff-opts RANGE_DIFF_OPTS`` + Additional arguments passed to ``git range-diff`` when comparing series with + ``--compare-to``. For example:: + + b4 prep --compare-to v1 --range-diff-opts "--creation-factor=80 --no-dual-color" diff --git a/docs/maintainer/diff.rst b/docs/maintainer/diff.rst index e6ba12ef1caf956b60a6022892c26b6af8de5de1..7911cdc054ef58d6f8c92383f23914962a63d659 100644 --- a/docs/maintainer/diff.rst +++ b/docs/maintainer/diff.rst @@ -42,6 +42,11 @@ Optional flags Compares two mbox files prepared by ``b4 am`` instead of querying the public-inbox server directly. +``--range-diff-opts RANGE_DIFF_OPTS`` + Additional arguments passed to ``git range-diff``. For example:: + + b4 diff --range-diff-opts "--creation-factor=80 --no-dual-color" + ``-o OUTDIFF, --output-diff OUTDIFF`` **(DEPRECATED)** Sends ``range-diff`` output into a file. You should use ``-n`` instead and redirect output from the actual ``git range-diff``