From patchwork Thu Feb 26 20:00:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1956 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=1772136165; bh=H9VflLXY3wBuqnGVq8oDj4vyY4KSuiiyiBOIn0cAn2M=; 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=l2UfY1JTdxFsH4ZqBSGf4yHjZVQQO8JWkK8f58WbDI1m/lsmXGmC0yQ8c/KiLrUtW gURPkk7mgYQQ/mxLfuoxECHdbErtqehduDJXMJolYfE+IrASpar5BhICW3k17f4zwU zHhqRA3txjbAyOsGMsQmAAwRcVFEjP2aWsezo5Rlm2xwtLGtfHljdgbFzGVAnevFws ay6CnkTkSrjm3po+YP0laxCECQBkcQy+BKiI1X3yz5fj2IvfXDD//IdtnBWtJtfEhI QFZdlavUlwDp/+6NSUAW9wyNBoSnbLLaSnvPyqDPaG7YY2cieYe2YMChkpzvAfN4q6 WxfiqEKeITF1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 738A869E39 for ; Thu, 26 Feb 2026 13:02: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 10024) with ESMTP id XBMZJw2uGJ0u for ; Thu, 26 Feb 2026 13:02:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136165; bh=H9VflLXY3wBuqnGVq8oDj4vyY4KSuiiyiBOIn0cAn2M=; 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=l2UfY1JTdxFsH4ZqBSGf4yHjZVQQO8JWkK8f58WbDI1m/lsmXGmC0yQ8c/KiLrUtW gURPkk7mgYQQ/mxLfuoxECHdbErtqehduDJXMJolYfE+IrASpar5BhICW3k17f4zwU zHhqRA3txjbAyOsGMsQmAAwRcVFEjP2aWsezo5Rlm2xwtLGtfHljdgbFzGVAnevFws ay6CnkTkSrjm3po+YP0laxCECQBkcQy+BKiI1X3yz5fj2IvfXDD//IdtnBWtJtfEhI QFZdlavUlwDp/+6NSUAW9wyNBoSnbLLaSnvPyqDPaG7YY2cieYe2YMChkpzvAfN4q6 WxfiqEKeITF1g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5D7AE69DAB for ; Thu, 26 Feb 2026 13:02:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136163; bh=UYVTE9ygR4x3KhMVXQoi7vBSgF1+v1wJWCFzg7u47K8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OaRTzbNbBguy9RRcfPwbNzpqxRv6UeYd5Yx78ZDmfthOHbBNGnkxtVODUzDsxdxwW 7sxitDu4LsE/jqHEnfSCz7OSh1PRbZ5m+ZnDfJb5NvpDhgLMcy6U3q5Vz6KujEN6KA EoNplYn1uJEVxP7FYi3JggNvrDRZOZDu35B0CcyB0F0FNpJUVzoHo5G5KhuCAB6s+f RW/5oLtVgLMzkKMdsSXPXNKnJ1NxE9NOkHe1IMn8b4UPD8dhCwZpuZhWnWc7Hzbp+X UYroBLbA7QQseFx8pAD4QnVEkqzcE6m7kitevdn21wXCZxRGvOdf5hdt6+uf/lSO6P nSMsv6o4+X6sQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5C1C669DAB; Thu, 26 Feb 2026 13:02:43 -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 RV1oepM5XbwX; Thu, 26 Feb 2026 13:02:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136158; bh=sFE3kKxoLjuU1sG104w8tq/T6XGMHRo5jvqkuiBaB4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ebq7KjHy8A4SHqvKgFwVHhUpwMLX3ICM3Hhtxej++3fBmKWjIYFEddq3RLwN2ArA6 HjnwHdpTMCRgrKppXrxqCPmCL8wmdSW+dqEXYvXEkP6adcI/o4ub0d2InclksNSj1+ i45RA86jLhoc1mNa3L2OkrJUGTyFPdOngX5++oMRyJUdEoJrOJCj76+hQWSvWi95zu vVeVdoopJGiCUN21QFXmuqGUXxaWZFvLqAzEjgRO8a3suoCXrQ3vEWLvE1YgEbtv9I fkdE8xxaZJzHxlPukPrWR3D8pFnyDH7mwhLWPJdjJXk/9u1Q5HCbkem9fAeGPyXGOO dpza5IgifOgEw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 006E869D79; Thu, 26 Feb 2026 13:02:37 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 26 Feb 2026 13:00:25 -0700 Message-ID: <20260226200106.1727176-20-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260226200106.1727176-1-sjg@u-boot.org> References: <20260226200106.1727176-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3QZK3OVEHSUNTST4MZTXFFDMKFGNBXS2 X-Message-ID-Hash: 3QZK3OVEHSUNTST4MZTXFFDMKFGNBXS2 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 19/32] patman: Allow setting the upstream when adding a series 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 Adding a series always creates it with no upstream, requiring a separate 'set-upstream' command afterwards. Add a -S/--set-upstream option to 'series add' so the upstream can be specified in one step. If the series already exists (e.g. when adding a new version), the upstream is also updated. Signed-off-by: Simon Glass --- tools/patman/cmdline.py | 2 ++ tools/patman/control.py | 3 ++- tools/patman/cseries.py | 17 ++++++++++------- tools/patman/test_cseries.py | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py index f24d0aacdff..57c56b099e1 100644 --- a/tools/patman/cmdline.py +++ b/tools/patman/cmdline.py @@ -242,6 +242,8 @@ def add_series_subparser(subparsers): add.add_argument( '-f', '--force-version', action='store_true', help='Change the Series-version on a series to match its branch') + add.add_argument('-S', '--set-upstream', + help='Set the upstream for this series') _add_mark(add) _add_allow_unmarked(add) _upstream_add(add) diff --git a/tools/patman/control.py b/tools/patman/control.py index e1f52300a17..7f162b4aadb 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -161,7 +161,8 @@ def do_series(args, test_db=None, pwork=None, cser=None): if args.subcmd == 'add': cser.add(args.series, args.desc, mark=args.mark, allow_unmarked=args.allow_unmarked, end=args.upstream, - use_commit=args.use_first_commit, dry_run=args.dry_run) + use_commit=args.use_first_commit, + ups=args.set_upstream, dry_run=args.dry_run) elif args.subcmd == 'archive': cser.archive(args.series) elif args.subcmd == 'autolink': diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py index 612ccfda7dc..6369b626035 100644 --- a/tools/patman/cseries.py +++ b/tools/patman/cseries.py @@ -39,7 +39,8 @@ class Cseries(cser_helper.CseriesHelper): super().__init__(topdir, colour) def add(self, branch_name, desc=None, mark=False, allow_unmarked=False, - end=None, use_commit=False, force_version=False, dry_run=False): + end=None, use_commit=False, force_version=False, ups=None, + dry_run=False): """Add a series (or new version of a series) to the database Args: @@ -47,13 +48,13 @@ class Cseries(cser_helper.CseriesHelper): desc (str): Description to use, or None to use the series subject mark (str): True to mark each commit with a change ID allow_unmarked (str): True to not require each commit to be marked - end (str): Add only commits up to but exclu - use_commit (bool)): True to use the first commit's subject as the + end (str): Add only commits up to but excluding this commit + use_commit (bool): True to use the first commit's subject as the series description, if none is available in the series or - provided in 'desc') - + provided in 'desc' force_version (bool): True if ignore a Series-version tag that doesn't match its branch name + ups (str or None): Name of the upstream for this series dry_run (bool): True to do a dry run """ name, ser, version, msg = self.prep_series(branch_name, end) @@ -70,7 +71,7 @@ class Cseries(cser_helper.CseriesHelper): raise ValueError(f"Branch '{name}' has no cover letter - " 'please provide description') if not desc: - desc = ser['cover'][0] + desc = ser.cover[0] # pylint: disable=E1136 ser = self._handle_mark(name, ser, version, mark, allow_unmarked, force_version, dry_run) @@ -80,9 +81,11 @@ class Cseries(cser_helper.CseriesHelper): added = False series_id = self.db.series_find_by_name(ser.name) if not series_id: - series_id = self.db.series_add(ser.name, desc) + series_id = self.db.series_add(ser.name, desc, ups=ups) added = True msg += f" series '{ser.name}'" + elif ups: + self.db.series_set_upstream(series_id, ups) if version not in self._get_version_list(series_id): svid = self.db.ser_ver_add(series_id, version, link) diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py index b14c6c22ddc..98acc1de184 100644 --- a/tools/patman/test_cseries.py +++ b/tools/patman/test_cseries.py @@ -799,6 +799,7 @@ Tested-by: Mary Smith # yak self.make_git_tree() args = Namespace(subcmd='add', desc='my-description', series='first', mark=False, allow_unmarked=True, upstream=None, + set_upstream=None, use_first_commit=False, dry_run=False) with terminal.capture() as (out, _): control.do_series(args, test_db=self.tmpdir, pwork=True) @@ -823,6 +824,21 @@ Tested-by: Mary Smith # yak 'first my-description ' '-/2 1', lines[2]) + def test_do_series_add_upstream(self): + """Test that series add can set the upstream""" + self.make_git_tree() + args = Namespace(subcmd='add', desc='my-description', series='first', + mark=False, allow_unmarked=True, upstream=None, + set_upstream='origin', + use_first_commit=False, dry_run=False) + with terminal.capture(): + control.do_series(args, test_db=self.tmpdir, pwork=True) + + cser = self.get_database() + slist = cser.db.series_get_dict() + ser = slist.get('first') + self.assertEqual('origin', ser.upstream) + def test_do_series_add_cmdline(self): """Add a new cseries using the cmdline""" self.make_git_tree() @@ -847,6 +863,7 @@ Tested-by: Mary Smith # yak force=True) args = Namespace(subcmd='add', series=None, mark=False, allow_unmarked=True, upstream=None, dry_run=False, + set_upstream=None, desc=None, use_first_commit=False) with terminal.capture(): control.do_series(args, test_db=self.tmpdir, pwork=True)