From patchwork Thu Feb 26 20:00:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1945 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=1772136125; bh=L1WY3pDcL1KxopCYeUdcm9kmRkO9Dv3pMPwxA/EqRSY=; 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=t/2NQVuMgzryW+xnO69aHoFUkO3rSxW440boalSxtK99ckYzwQarMQOEFJpeoBbwY VDigvrayCgB/uM+C4Stc93JCftymVOSMyOnNTjsY44xEUs5EI7ma0AGjI7QN5pYt31 kRuMcosuYN6dh7O3pYAzo0wqyh2BJyKXQvb7RmXHsHc4Cdy5Z7VMY6NrapXzSWT3eg XDUH02Pd8e9iSYiF0YtvfRbmgcSw6G2DfRrocMmMiKuoL73POxVt/Nj5m7V9mz8MbK cq8j1eO2uhSV0e/sW6wRaQibjLUUdV2uiTmYzPlC/aw53hZ07pcnS+tLvfLV7XHX4Z JjWd1UkaQmbGA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1207C69E36 for ; Thu, 26 Feb 2026 13:02:05 -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 eu-iXXtv16PH for ; Thu, 26 Feb 2026 13:02:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136125; bh=L1WY3pDcL1KxopCYeUdcm9kmRkO9Dv3pMPwxA/EqRSY=; 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=t/2NQVuMgzryW+xnO69aHoFUkO3rSxW440boalSxtK99ckYzwQarMQOEFJpeoBbwY VDigvrayCgB/uM+C4Stc93JCftymVOSMyOnNTjsY44xEUs5EI7ma0AGjI7QN5pYt31 kRuMcosuYN6dh7O3pYAzo0wqyh2BJyKXQvb7RmXHsHc4Cdy5Z7VMY6NrapXzSWT3eg XDUH02Pd8e9iSYiF0YtvfRbmgcSw6G2DfRrocMmMiKuoL73POxVt/Nj5m7V9mz8MbK cq8j1eO2uhSV0e/sW6wRaQibjLUUdV2uiTmYzPlC/aw53hZ07pcnS+tLvfLV7XHX4Z JjWd1UkaQmbGA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0154569DAB for ; Thu, 26 Feb 2026 13:02:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136123; bh=v8zmP3JzaE35ShRC8IBxJZHbnGsrOvzy+faMixKqqoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rclIMgIRdQyTXaNz6+tfv7vhTg1kF4RW4wtXMjZ/yDAeJIBH98TayapksKaHFpGZB 4YxIqiMuILagB2RlCPj/UvbblFvbBqI+fZgrLdzNSdvb1TWnFlyliKSja/UJBSz6Av Nigm0T2/juogmgeclzockmKIjvpwg+ow8oqMddv6d+HsNLxfUKs08/95DXYIF/7pCT cr/KEQ39lOXWLA7nRNE2cdTYqMbONk/tsRYFmaV/SOpfSObPoTvG6WKj95vecxZ/jP h/GQsu6Cz4gExOvsfP7hqxqPplF9mXL1Pd1NSjHGMwpDLtk0N4R8g9odAkJrxjuycg OoZz8jhipEzyQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2E93D69DAB; Thu, 26 Feb 2026 13:02:03 -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 YJYyad8QMkfy; Thu, 26 Feb 2026 13:02:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136119; bh=RWdDEfuHvMud4mIPeN0Ibf3fPvALW1A2dVCh5Md9TGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnTWapt4lVrmecMfKi7EduKhzLb2R25GKcueiMTZGxJ/CJ/+QesREW4OPwFCjNfBw TPkDZM6RkSavEwKUiRBJAT3ix5c1ecsKyvwlpKB4hRnonI3s1hD9u9eXs8tjvqg07r rqxOSGS8Kh90tnqXGgudRuin0QxsRe8ScXV3+5R14Tif7SgSWiCGv9/kN8fTqNgCnh wH1okkibcSJ+2+MBrDSoJ7CzGJ54D6K2AeBmMUPj7F7aKCkhmdATg3cDmB6ryImVKd sv2eVD87kswUrA+q/RUa3O65c7P2BIWfbz7KMbfXHQybz7zFdXBUSM/LResX2Maq6e 99zWEi8o6bCwQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BEB7069D4A; Thu, 26 Feb 2026 13:01:58 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 26 Feb 2026 13:00:14 -0700 Message-ID: <20260226200106.1727176-9-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: LNQTOUXY2NKL2FJKS73SZJFNH6H77NHE X-Message-ID-Hash: LNQTOUXY2NKL2FJKS73SZJFNH6H77NHE 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 08/32] patman: Add set-upstream command for 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 Add a 'series set-upstream' subcommand to allow setting or changing the upstream for an existing series. This uses the existing series_set_upstream() database method and follows the same pattern as the rename command. Usage: patman series -s set-upstream -u Signed-off-by: Simon Glass --- tools/patman/cmdline.py | 4 ++++ tools/patman/control.py | 3 +++ tools/patman/cseries.py | 25 +++++++++++++++++++++++++ tools/patman/test_cseries.py | 17 +++++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py index f80323b7853..65b9dfab4bb 100644 --- a/tools/patman/cmdline.py +++ b/tools/patman/cmdline.py @@ -298,6 +298,10 @@ def add_series_subparser(subparsers): ren.add_argument('-N', '--new-name', help='New name for the series') series_subparsers.add_parser('rm') + + sup = series_subparsers.add_parser('set-upstream') + sup.add_argument('upstream_name', nargs='?', + help='Name of the upstream for this series') series_subparsers.add_parser('rm-version', aliases=ALIASES['rm-version']) scan = series_subparsers.add_parser('scan') diff --git a/tools/patman/control.py b/tools/patman/control.py index c6fede4305b..1a65dfc2cc6 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -191,6 +191,9 @@ def do_series(args, test_db=None, pwork=None, cser=None): cser.version_remove(args.series, args.version, dry_run=args.dry_run) elif args.subcmd == 'rename': cser.rename(args.series, args.new_name, dry_run=args.dry_run) + elif args.subcmd == 'set-upstream': + cser.set_upstream(args.series, args.upstream_name, + dry_run=args.dry_run) elif args.subcmd == 'scan': cser.scan(args.series, mark=args.mark, allow_unmarked=args.allow_unmarked, end=args.upstream, diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py index 6c918185387..246610215ed 100644 --- a/tools/patman/cseries.py +++ b/tools/patman/cseries.py @@ -770,6 +770,31 @@ class Cseries(cser_helper.CseriesHelper): if dry_run: tout.info('Dry run completed') + def set_upstream(self, series, ups, dry_run=False): + """Set the upstream for a series + + Args: + series (str): Name of series to use, or None to use current branch + ups (str): Name of the upstream to set + dry_run (bool): True to do a dry run + """ + if not ups: + raise ValueError('Please specify the upstream name') + ser, _ = self._parse_series_and_version(series, None) + if not ser.idnum: + raise ValueError(f"Series '{ser.name}' not found in database") + + self.db.series_set_upstream(ser.idnum, ups) + + if not dry_run: + self.commit() + else: + self.rollback() + + tout.notice(f"Set upstream for series '{ser.name}' to '{ups}'") + if dry_run: + tout.info('Dry run completed') + def scan(self, branch_name, mark=False, allow_unmarked=False, end=None, dry_run=False): """Scan a branch and make updates to the database if it has changed diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py index e529d9fe61b..c6b90d5223d 100644 --- a/tools/patman/test_cseries.py +++ b/tools/patman/test_cseries.py @@ -1909,6 +1909,23 @@ Tested-by: Mary Smith # yak slist = cser.db.series_get_dict() self.assertIsNone(slist['first'].upstream) + def test_series_set_upstream(self): + """Test setting upstream via the set-upstream command""" + cser = self.get_cser() + with terminal.capture(): + cser.add('first', '', allow_unmarked=True) + + self.db_close() + with terminal.capture() as (out, _): + self.run_args('series', '-s', 'first', 'set-upstream', + 'origin') + self.assertIn("Set upstream for series 'first' to 'origin'", + out.getvalue()) + + self.db_open() + slist = cser.db.series_get_dict() + self.assertEqual('origin', slist['first'].upstream) + def test_series_add_mark(self): """Test marking a cseries with Change-Id fields""" cser = self.get_cser()