From patchwork Thu Feb 12 21:16:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1840 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=1770931009; bh=C1L8ZUy/QFvDqttZkgFS3benvTNpvGhBNCBs902NEyY=; 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=APypzLHJU+rKHn/TlH2FIleBQmhewm9SIwy4cTQzHPzbKceknlLaKFDtJ/t6QtGke o85zZ6K/rM1hOc1Q6DdmOZIrSBPmZqnyc5TbtN8hueCqYNv94Gk4oToBdxkyDYQm1J wYlBtg5CrvYJG2yv8tt1NQE0fnVM+4CWGEN092s4D75Bzf3WpOttV0oOfP0CLBykXV mfk7lC7612y6I1Nx8LrYGKGmSgrfjVmhHs53fKycRdtq85gYYP8q2ktUwJLkAIAKRU K2FSpf1u0RjS7bQ9EwGviMCC6K1dGpPi+wh3AWq6hj9GQCkas3Rmv2VOPMmhtT3Rbd PDeEm2LcM18fg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 24D1B69AE6 for ; Thu, 12 Feb 2026 14:16:49 -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 7i1NyPclARLg for ; Thu, 12 Feb 2026 14:16:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770931009; bh=C1L8ZUy/QFvDqttZkgFS3benvTNpvGhBNCBs902NEyY=; 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=APypzLHJU+rKHn/TlH2FIleBQmhewm9SIwy4cTQzHPzbKceknlLaKFDtJ/t6QtGke o85zZ6K/rM1hOc1Q6DdmOZIrSBPmZqnyc5TbtN8hueCqYNv94Gk4oToBdxkyDYQm1J wYlBtg5CrvYJG2yv8tt1NQE0fnVM+4CWGEN092s4D75Bzf3WpOttV0oOfP0CLBykXV mfk7lC7612y6I1Nx8LrYGKGmSgrfjVmhHs53fKycRdtq85gYYP8q2ktUwJLkAIAKRU K2FSpf1u0RjS7bQ9EwGviMCC6K1dGpPi+wh3AWq6hj9GQCkas3Rmv2VOPMmhtT3Rbd PDeEm2LcM18fg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 12DF569ABF for ; Thu, 12 Feb 2026 14:16:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770931007; bh=Awb5MFo/RDwou8JmrkQP2zxElLRCEpV3jyEKDmSizgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lf5ybY6weWTU+4bb9LxuIGIoK6tiqcwcnjy1mRWmtaMVSYFoMXdbtzeb1AnttJIUC QOz2UUBYnSBxPMMUAtwuubtoyD1Fi5sWbEelvRhj9pt5jNVVx02nPtDXTb8S//nN7O OXiE1FEYMZnVo6UffyyVoq4XZ2a0/5o640UafmISkN+U38rIVYat4ETQ2n+O/ofBuV R/XY0L7wYyV4w9tpT8WEeux4D6bxPTtLXv9cvHlnboLImuGsTHcz2ebPQD+VITei0N KIRYicFdC9ZdgHCYrquTXffvrxfXMqqV49yv2cpo+6nT4IgPz7sAw7qv25rX0xP/0Y Pgi1lhhVKx3BQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CAECD69ABB; Thu, 12 Feb 2026 14:16:47 -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 i-iLw2xNlQZs; Thu, 12 Feb 2026 14:16:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770931003; bh=rbFrN4xextnJF+EcExHYrCgG8fBtJOhWXhe6WMXjmkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tfpRaZ4IgYsPNTkSqryfGcpg2ytnDrwC8+Lbvq5rlOYjBwMwX5HyMozUmDVIyfh/s OvZ0Li/9Wyj3MT13oicrYQq6Sfmr21inqMWInswjeo8d+EVMxVNTJGAHvKFSsxcoqQ 18BVUreuHHWxyVVFaPAJKgwK+P5LnPEI+GF5U8LagB/K0moTvTTpqWEV7uuY2GlZrn eySdxXjThy9wwqKpJWj2OcF7MvpAIbBPaEl+C9xbuihEbSgQ6/tyRdkTUQ9XupZ3YB 9Y1N4MagZZum12QaquN3T3AfG1KfTq8sKbTeAPDZPxf1jmpfh4r2LY5g7mA+rpUL2X 1DXfxsy6EXilg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 493F26994D; Thu, 12 Feb 2026 14:16:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 12 Feb 2026 14:16:15 -0700 Message-ID: <20260212211626.167191-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212211626.167191-1-sjg@u-boot.org> References: <20260212211626.167191-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: Z574GEQ6WVVKIFYIS2I3Y74GSL6HFPVA X-Message-ID-Hash: Z574GEQ6WVVKIFYIS2I3Y74GSL6HFPVA 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 , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 2/9] pickman: Extract build_applied_map() from execute_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 Move the creation of the applied-commit mapping into its own function to reduce duplication of the grep logic already in check_already_applied() and simplify execute_apply() Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- tools/pickman/control.py | 43 +++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/tools/pickman/control.py b/tools/pickman/control.py index f533b00ef60..54e1c568d7b 100644 --- a/tools/pickman/control.py +++ b/tools/pickman/control.py @@ -542,6 +542,34 @@ def check_already_applied(commits, target_branch='ci/master'): return new_commits, applied +def build_applied_map(commits): + """Build a mapping of commit hashes to their applied counterparts + + Checks which commits have already been applied to the target branch + and returns a dict mapping original hashes to the applied hashes. + + Args: + commits (list): List of CommitInfo tuples to check + + Returns: + dict: Mapping of original commit hash to applied commit hash + """ + _, applied = check_already_applied(commits) + + applied_map = {} + if applied: + for c in applied: + escaped_subject = c.subject.replace('"', '\\"') + result = run_git(['log', '--oneline', 'ci/master', + f'--grep={escaped_subject}', '-1']) + if result.strip(): + applied_hash = result.split()[0] + applied_map[c.hash] = applied_hash + tout.info(f'Found {len(applied)} potentially already applied' + ' commit(s)') + return applied_map + + def show_commit_diff(res, no_colour=False): """Show the difference between original and cherry-picked commit patches @@ -1336,20 +1364,7 @@ def execute_apply(dbs, source, commits, branch_name, args): # pylint: disable=t 1 on failure """ # Check for already applied commits before proceeding - _, applied = check_already_applied(commits) - - # Build mapping of applied commits by hash - applied_map = {} - if applied: - for c in applied: - # Get the hash of the applied commit in target branch - escaped_subject = c.subject.replace('"', '\\"') - result = run_git(['log', '--oneline', 'ci/master', - f'--grep={escaped_subject}', '-1']) - if result.strip(): - applied_hash = result.split()[0] - applied_map[c.hash] = applied_hash - tout.info(f'Found {len(applied)} potentially already applied commit(s)') + applied_map = build_applied_map(commits) # Add all commits to database with 'pending' status (agent updates later) source_id = dbs.source_get_id(source)