From patchwork Wed Dec 17 02:28:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 957 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=1765938587; bh=2a0ZQ5X0RQy8VTUoi83cINn0jZnNu7ND9Xgs1FSIVpQ=; 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=iqzoIU14W9nhtboCKH4ssRyJLTGnOZkbWHfpyAljlariNmvjaJTleV/tv2FwhsOwL g5qDty2SYXL7s5Bi5WymjMGZteK/+XtMN1J4fDinjxkGZFDhl8shH+jiH6qH4yODzj Eh5nY4PCu4hrTstVzXTi/7kNsoEPMaymwIQX5MtQQji/2gis9FQgLgGQGsma+V1JtA 1oqWSpFewPiKc2v8beUH9V3l/jYlxiJxzFRXIptqbzJoUSTWiSLM22j3/X+A0Xz+Vt SWakzknXMtdRl9s8e5VLw7H8gQIBxoqgkwB4Vn9r2V5Ff0d4F2sUY8VIkIJoHUGFS7 QdSCcZAO/7i7g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3FFC168BA0 for ; Tue, 16 Dec 2025 19:29: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 10024) with ESMTP id kzs0X9BcTqCb for ; Tue, 16 Dec 2025 19:29:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938587; bh=2a0ZQ5X0RQy8VTUoi83cINn0jZnNu7ND9Xgs1FSIVpQ=; 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=iqzoIU14W9nhtboCKH4ssRyJLTGnOZkbWHfpyAljlariNmvjaJTleV/tv2FwhsOwL g5qDty2SYXL7s5Bi5WymjMGZteK/+XtMN1J4fDinjxkGZFDhl8shH+jiH6qH4yODzj Eh5nY4PCu4hrTstVzXTi/7kNsoEPMaymwIQX5MtQQji/2gis9FQgLgGQGsma+V1JtA 1oqWSpFewPiKc2v8beUH9V3l/jYlxiJxzFRXIptqbzJoUSTWiSLM22j3/X+A0Xz+Vt SWakzknXMtdRl9s8e5VLw7H8gQIBxoqgkwB4Vn9r2V5Ff0d4F2sUY8VIkIJoHUGFS7 QdSCcZAO/7i7g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CC656897B for ; Tue, 16 Dec 2025 19:29:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938585; bh=tW0C0iceCPOFsmt3HYpmgq1pezV4rlvi7wcOYm72tfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p123VFT08w/OCps2HpPFkL29zH5hVkAEcbpi+41gRqezPmM90AiE++SmC3V3z5mWM rRFxiLQyf56IpzxjqjsaIG4znZhriLfmVEvyFJn4IS8PjM3LaMaMjPjam3bpZ6hZZV WIE/BiatmC+2aUoO8lMqrCJfRDlbq/K9jg29tz2grKqqxT1sR0HvOjh9DCSjF2M3vy cSPaQdu3HwHxPejVX7G9h791QKVQojAIqshLS04u4JE0Uyne5bpvJC0qZSiHsmt/k/ QVu/MG/u4sqHApvCd4TQb9elHHiULtzBGeH+RQVuGcT0BQLo4qzAD3k0yjYsKRAWXs PGSPSv2UkcqSg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BFCE16897B; Tue, 16 Dec 2025 19:29:45 -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 aSClAMffi3DG; Tue, 16 Dec 2025 19:29:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938579; bh=LtdgVhaApIxylUImIU+m9PsqvwNb2rAnw8LFMdi0luA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abrhy9KGiKrMz7LdjRfeMNSyRW4bdcoHrfcPX80J/urtkDVoUXVfkCkQpadiQ6HY2 Ubz0bpQL17Cs4N8A4tgihSMtV3HxMontmgfWTZfEM6A5z7IzL6DUsYNdTiDWwdttW1 CErGGbcaDTwWRUDYAD9Ht2e6+yqJkdRmUZj0uk7YqcZdTFSYpSP90dsuigj0rHm+UR vNceSqNIR5eJpgh47+ubVmOWBEIH6Uw4VuTYZJwHLdGkoJXIhuX4nwFzCCsvLIp+4I YYhxrqBq26lJQ8hWSM6GKPS7ZyYCjLXg7L1RPX9ApeXVg84naULo5kTbebtP4vk3Yy f63KMlPd3FHag== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A9E2E68AFF; Tue, 16 Dec 2025 19:29:39 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 19:28:03 -0700 Message-ID: <20251217022823.392557-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251217022823.392557-1-sjg@u-boot.org> References: <20251217022823.392557-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SIXRNMW6MS4C2A46MZCVKKX5O7B5N6YO X-Message-ID-Hash: SIXRNMW6MS4C2A46MZCVKKX5O7B5N6YO 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 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 14/24] pickman: Fix parse_mr_description to ignore short numbers 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 The regex for extracting commit hashes from MR descriptions was matching short numbers like "1" from the conversation log (e.g., "- 1 board built"). Fix by requiring commit hashes to be at least 7 characters, which is the minimum length for git short hashes. Shorten the argument name to 'desc' while we are here. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/pickman/control.py | 10 +++++----- tools/pickman/ftest.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/tools/pickman/control.py b/tools/pickman/control.py index 7ac0fffc67a..acb3b80a4a7 100644 --- a/tools/pickman/control.py +++ b/tools/pickman/control.py @@ -651,23 +651,23 @@ def do_review(args, dbs): # pylint: disable=unused-argument return 0 -def parse_mr_description(description): +def parse_mr_description(desc): """Parse a pickman MR description to extract source and last commit Args: - description (str): MR description text + desc (str): MR description text Returns: tuple: (source_branch, last_commit_hash) or (None, None) if not parseable """ # Extract source branch from "## date: source_branch" line - source_match = re.search(r'^## [^:]+: (.+)$', description, re.MULTILINE) + source_match = re.search(r'^## [^:]+: (.+)$', desc, re.MULTILINE) if not source_match: return None, None source = source_match.group(1) - # Extract commits from "- hash subject" lines - commit_matches = re.findall(r'^- ([a-f0-9]+) ', description, re.MULTILINE) + # Extract commits from '- hash subject' lines (must be at least 7 chars) + commit_matches = re.findall(r'^- ([a-f0-9]{7,}) ', desc, re.MULTILINE) if not commit_matches: return None, None diff --git a/tools/pickman/ftest.py b/tools/pickman/ftest.py index d452fc823ca..ab4cceccac7 100644 --- a/tools/pickman/ftest.py +++ b/tools/pickman/ftest.py @@ -1355,6 +1355,24 @@ Branch: cherry-abc""" self.assertIsNone(source) self.assertIsNone(last_hash) + def test_parse_mr_description_ignores_short_hashes(self): + """Test that short numbers in conversation log are not matched.""" + description = """## 2025-01-15: us/next + +Branch: cherry-abc123 + +Commits: +- abc123a First commit +- def456b Second commit + +### Conversation log +- 1 board built (sandbox) +- 2 tests passed""" + source, last_hash = control.parse_mr_description(description) + self.assertEqual(source, 'us/next') + # Should match def456b, not "1" or "2" from conversation log + self.assertEqual(last_hash, 'def456b') + class TestStep(unittest.TestCase): """Tests for step command."""