From patchwork Sat Apr 4 21:29:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2146 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=1775338401; bh=KcaTvZT/zj6mO1JaN/dXzv8SRixj09+ThZ6jz85f0B0=; 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=ur0w6pyzoqfmLlhRtlFt2UVGcWhvWTyx0rAAZYzUZYoKFJNRUNhLbk/pUs9y71MTD KhIstySSMbZ8+q2dPkJCORLY85jCKr51EWxncp4hwD2dAA8hUHpaUygU3wo12No/3z yz5UYEBtwaYUk8c4Cc+E3GObI/Qi/gm0x3o1rXTphW9IVfgWHRfJWSoFxFnv4K7FJe jdWc8GEAUXd/cw5dpNw+Mj39FoxjjxQLqKX1ccA/RwqgeUP+GHJPhqXsZKBjSV+GLV ymmA41qXECtK5qcrzyDuXR6OfxpmSiansN6vJyrDXRK5LDejJXGM5Gnb1kXbYYM0rH AZw9MvjWMgeiA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 757B868F53 for ; Sat, 4 Apr 2026 15:33:21 -0600 (MDT) 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 pMoaHVf_SIn5 for ; Sat, 4 Apr 2026 15:33:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338401; bh=KcaTvZT/zj6mO1JaN/dXzv8SRixj09+ThZ6jz85f0B0=; 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=ur0w6pyzoqfmLlhRtlFt2UVGcWhvWTyx0rAAZYzUZYoKFJNRUNhLbk/pUs9y71MTD KhIstySSMbZ8+q2dPkJCORLY85jCKr51EWxncp4hwD2dAA8hUHpaUygU3wo12No/3z yz5UYEBtwaYUk8c4Cc+E3GObI/Qi/gm0x3o1rXTphW9IVfgWHRfJWSoFxFnv4K7FJe jdWc8GEAUXd/cw5dpNw+Mj39FoxjjxQLqKX1ccA/RwqgeUP+GHJPhqXsZKBjSV+GLV ymmA41qXECtK5qcrzyDuXR6OfxpmSiansN6vJyrDXRK5LDejJXGM5Gnb1kXbYYM0rH AZw9MvjWMgeiA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 64DED6833B for ; Sat, 4 Apr 2026 15:33:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338398; bh=3sKh1rj6sXdUNSTTCbK9b2W+ybK/ClBkyo3R8HCiTq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLnTJNHIb4cTKESa5ca5D3bxdliJHMdxrL7D6PS6+37aHFVcNbi7Hgi7gNV99dTuS 4BXodsRBba4Ms62uaIP3dXM8ECW9Ql3hAmsjbEeXVr1qquWOu1vYIkb7G/3i/6vvOU geB6o409YW7XYLboh/YL9XH977ap5QpiLnAiQWLRtGUIYdmwfMkT5FrjJDWDLn84lz DloRXnSzzXjJhluDlc8Om4GzizwxmPtuX1KZVacttoKfnKzI4r3+I2KTcJSsftW7iF GJMoZLhnSXU2aEimYIEqM4q4lUTqyz1AU1pOK+ZHJBY5d5AuXQwrzMIrv/C9BtbjN0 lruC6Ey0c90Og== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EE52669015; Sat, 4 Apr 2026 15:33:18 -0600 (MDT) 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 OJ7N2wH4VqR0; Sat, 4 Apr 2026 15:33:18 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338397; bh=zbs6oSIHI986i/82jMlolJYk1x28S5c/QC4oxAFBgro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IG0B1IS48WYqlyUfJ7lQ8JE5I/XqVrrtXkxtk82h1fOp/DZ03rmYt/ZVdRXpUFm/h 6t3QSwfuxTXcdZAQbyr/+2SZmwQ5uOrIqAIJ1tffOL/1MrHfNYl4E2ExGKhIjXRgSn 5yHS8AMhWkrrsT9o5+m+UdQordbWbwIo315Go4WA7GLxc1arr6mP9TSXW8KMgub74e 4Xeazrlb6Ei8jl8w2f4f80CAwnQx/F2r2ugfzws3dG2ewpYG49WYF5FhpWZeFM+SjC 2Nc6qZvIV2u4HeSGR6VYFhr2YPVFPQ4zGFKxzTtTXQwXW8FBDSb1/oQUv/HM1IbYnU OUbvUyiGS650A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 72C985E7B4; Sat, 4 Apr 2026 15:33:17 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sat, 4 Apr 2026 15:29:08 -0600 Message-ID: <20260404213020.372253-33-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260404213020.372253-1-sjg@u-boot.org> References: <20260404213020.372253-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NFT25AHUTUPCERYERP33AWLOT22ZGYZ3 X-Message-ID-Hash: NFT25AHUTUPCERYERP33AWLOT22ZGYZ3 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 32/37] patman: Add patchwork method to fetch user comments for voice learning 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 Add fetch_user_comments() to the Patchwork class, which retrieves recent review comments by a given user email. This is used by the voice-learning feature to build a style profile from past reviews posted to patchwork. Signed-off-by: Simon Glass --- tools/patman/patchwork.py | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tools/patman/patchwork.py b/tools/patman/patchwork.py index 3e8f7c6c62c..5613cbb3383 100644 --- a/tools/patman/patchwork.py +++ b/tools/patman/patchwork.py @@ -12,6 +12,7 @@ import aiohttp from collections import namedtuple from u_boot_pylib import terminal +from u_boot_pylib import tout # Information passed to series_get_states() # link (str): Patchwork link for series @@ -808,6 +809,54 @@ On Tue, 4 Mar 2025 at 06:09, Simon Glass wrote: cover = COVER(cover_id, len(info), cover['name'], info) return cover + async def fetch_user_comments(self, client, user_email, max_comments=20): + """Fetch comments made by a user on recent patches + + Paginates through recent patches for the project, fetching + comments on each until the target count is reached. + + Args: + client (aiohttp.ClientSession): Session to use + user_email (str): Email address to match + max_comments (int): Number of comments to collect + + Returns: + list of str: Comment body texts + """ + comments = [] + page = 1 + per_page = 50 + patches_scanned = 0 + + while len(comments) < max_comments: + patches = await self._request( + client, f'patches/?project={self.proj_id}&order=-date' + f'&per_page={per_page}&page={page}') + if not patches: + break + + for patch in patches: + if len(comments) >= max_comments: + break + patches_scanned += 1 + tout.progress( + f'Scanned {patches_scanned} patches, ' + f'found {len(comments)}/{max_comments} comments') + patch_comments = await self._request( + client, f"patches/{patch['id']}/comments/") + for comment in patch_comments: + submitter = comment.get('submitter', {}) + if submitter.get('email') == user_email: + content = comment.get('content', '') + if content and '>' in content: + comments.append(content) + if len(comments) >= max_comments: + break + + page += 1 + tout.clear_progress() + return comments + async def series_get_state(self, client, link, read_comments, read_cover_comments): """Sync the series information against patchwork, to find patch status