From patchwork Sun Feb 22 15:42:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1928 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771775038; bh=WwX1DcfBuOT5ZFf3oWeYDDdFd3e+aI5UFbhNdGek0qo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RscykknbHD3ZgS38Cml45ZTVuS0s2sFh9yU96jXUAQh2MqZUsHojAGMcDy37HjogU P4sVNULwrlbprEL3S7/Qfuqg5dMn2ZZkOv63uhUCQbBk/5dZKNUZ/AymLnK1bxvifT Z6L3EJAlfWjIq5oVnjN1yMiCymz5dg+a/ySTefp8kW6DiCVEtWLPhKij/Ii7oyyobC /YZU57fvlc79Ox11rcYGMUUWYHc0sxqXZq0M30WpVOvD1eYjWSKFbtUK0eUv+1W3af bIFIY6NHvDkIYHK/mhJXhIDhzc6Cl3b43qBz5v0eRFSkwPWBFYTlRdXDk6Yuo/EjuA yrBrnU2Vi9+Nw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 588A969D42 for ; Sun, 22 Feb 2026 08:43:58 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7IKmZA2_c6e0 for ; Sun, 22 Feb 2026 08:43:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771775038; bh=WwX1DcfBuOT5ZFf3oWeYDDdFd3e+aI5UFbhNdGek0qo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RscykknbHD3ZgS38Cml45ZTVuS0s2sFh9yU96jXUAQh2MqZUsHojAGMcDy37HjogU P4sVNULwrlbprEL3S7/Qfuqg5dMn2ZZkOv63uhUCQbBk/5dZKNUZ/AymLnK1bxvifT Z6L3EJAlfWjIq5oVnjN1yMiCymz5dg+a/ySTefp8kW6DiCVEtWLPhKij/Ii7oyyobC /YZU57fvlc79Ox11rcYGMUUWYHc0sxqXZq0M30WpVOvD1eYjWSKFbtUK0eUv+1W3af bIFIY6NHvDkIYHK/mhJXhIDhzc6Cl3b43qBz5v0eRFSkwPWBFYTlRdXDk6Yuo/EjuA yrBrnU2Vi9+Nw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2162C69C5E for ; Sun, 22 Feb 2026 08:43:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771775035; bh=5qYU+atroB1yOmLH3jheXyJRiLJGOU43LOatkILD0VE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fS6wfxroggrODjOxFgb+D138CH6NCzNxNm+SIdk5+nhhBfnTIZ275sYiknd4Nj8us w3XSWCG9hWhXDwQuy5VYrT6gVNW2v8WAEfmv+U9ZflDMQG/k6pvDjDwyVFOtiW4mRc vPHn/lUhW6cEs1KcHx5plzmCKS7XZVdG/HiXRc7drmObYiAL74f+eIP7tzLX8u4WnD o1sKhqjLlKWH/FSg84dl527FGBe1ZoXkNtE4UvdHHuJNyV5w3ZBi0phCErpffzcEYJ X6t4NuI/Wl+cZrF4xf4bQL1n7aXYxVACxahIctxo+5/sLecIRQow+XGbLyzlCJjDTr 2nQc7tvdsxaRA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E80AC69C5E; Sun, 22 Feb 2026 08:43:55 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id qCwzgysB1Zp1; Sun, 22 Feb 2026 08:43:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771775031; bh=VjAPjjgEJNxZ2QcuEK8r3JroBHZNGxovv52fCfs21X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNPIweYEXFSv/JDRhCXxbljfOKUEu8HydHy4rwP1JIFIy999bAEe62nI2Bsvf+Hww F5rcixRfYWCxDBuJn/mMtDRLG8dKXhb/2zxhw5WB9r0k9ksbp45yy6IKwHAsSAbLR2 43wGaDX5uqJodJcHsDi6w40u1sufbtbjXH4DCalgEVKg2xM/u4pxJngdX5cAfgzA1Z 13KyPldFOfzWvFEi3jAbXRZl8d4xyw2oDUlJIx0np/hL+KNKMBzHy1AtF3tE83o/k3 iVeLn5qpEu7vLxqNcJm87oJU7zTsFpNZS8NB2YX5r2f+s03TfHz+mcmuVJGxPP7bjL Qrb2xt6adKTYA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C0CD569C5C; Sun, 22 Feb 2026 08:43:50 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 22 Feb 2026 08:42:47 -0700 Message-ID: <20260222154303.2851319-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260222154303.2851319-1-sjg@u-boot.org> References: <20260222154303.2851319-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KQ6HHZC2CTKGMDPTA4YUUUDXNGL7ODFD X-Message-ID-Hash: KQ6HHZC2CTKGMDPTA4YUUUDXNGL7ODFD X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/16] pickman: Refactor the initial part of prepare_apply() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Create a new _prepare_get_commits() helper to handle finding the next set of commits to process. This helps to reduce the size of prepare_apply() Signed-off-by: Simon Glass --- tools/pickman/control.py | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tools/pickman/control.py b/tools/pickman/control.py index 39ce57d0895..3e69cba7a9a 100644 --- a/tools/pickman/control.py +++ b/tools/pickman/control.py @@ -1473,40 +1473,57 @@ def push_mr(args, branch_name, title, description): return bool(mr_url) -def prepare_apply(dbs, source, branch): - """Prepare for applying commits from a source branch +def _prepare_get_commits(dbs, source): + """Get the next commits to apply, handling skips. - Gets the next commits, sets up the branch name, and prints info about - what will be applied. + Fetches the next batch of commits from the source. Args: dbs (Database): Database instance source (str): Source branch name - branch (str): Branch name to use, or None to auto-generate Returns: - tuple: (ApplyInfo, return_code) where ApplyInfo is set if there are - commits to apply, or None with return_code indicating the result - (0 for no commits, 1 for error) + tuple: (NextCommitsInfo, return_code) where return_code is None + on success, or an int (0 or 1) if there is nothing to do """ info, err = get_next_commits(dbs, source) - if err: tout.error(err) return None, 1 if not info.commits: - # If advance_to is set, advance source past fully-processed merges if info.advance_to: dbs.source_set(source, info.advance_to) dbs.commit() tout.info(f"Advanced source '{source}' to " f'{info.advance_to[:12]}') - # Retry with updated position - return prepare_apply(dbs, source, branch) - tout.info('No new commits to cherry-pick') + else: + tout.info('No new commits to cherry-pick') return None, 0 + return info, None + + +def prepare_apply(dbs, source, branch): + """Prepare for applying commits from a source branch + + Gets the next commits, sets up the branch name, and prints info about + what will be applied. + + Args: + dbs (Database): Database instance + source (str): Source branch name + branch (str): Branch name to use, or None to auto-generate + + Returns: + tuple: (ApplyInfo, return_code) where ApplyInfo is set if there are + commits to apply, or None with return_code indicating the result + (0 for no commits, 1 for error) + """ + info, ret = _prepare_get_commits(dbs, source) + if ret is not None: + return None, ret + commits = info.commits # Save current branch to return to later