[PATCH 3/7] patman: Allow listing archived series
Simon Glass
sjg at chromium.org
Sat May 24 19:06:51 CEST 2025
Sometimes it is useful to include archived series in the listing so you
can see which series could potentially be unarchived. Add a flag for
this.
Add a --include-archived option to the 'series ls' command for this.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tools/patman/cmdline.py | 8 +++++++-
tools/patman/control.py | 2 +-
tools/patman/cseries.py | 9 ++++++---
tools/patman/test_cseries.py | 24 ++++++++++++++++++++++++
4 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py
index 924f0ad4e42..18bcece211f 100644
--- a/tools/patman/cmdline.py
+++ b/tools/patman/cmdline.py
@@ -138,6 +138,11 @@ def _add_show_cover_comments(parser):
help='Show comments from the cover letter')
+def _add_archived(parser):
+ parser.add_argument('-A', '--include-archived', action='store_true',
+ help='Show archived series as well')
+
+
def add_patchwork_subparser(subparsers):
"""Add the 'patchwork' subparser
@@ -262,7 +267,8 @@ def add_series_subparser(subparsers):
series_subparsers.add_parser('get-link')
series_subparsers.add_parser('inc')
- series_subparsers.add_parser('ls')
+ ls = series_subparsers.add_parser('ls')
+ _add_archived(ls)
mar = series_subparsers.add_parser('mark')
mar.add_argument('-m', '--allow-marked', action='store_true',
diff --git a/tools/patman/control.py b/tools/patman/control.py
index 1250fa10c62..d898a4482af 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -174,7 +174,7 @@ def do_series(args, test_db=None, pwork=None, cser=None):
elif args.subcmd == 'inc':
cser.increment(args.series, args.dry_run)
elif args.subcmd == 'ls':
- cser.series_list()
+ cser.series_list(args.include_archived)
elif args.subcmd == 'open':
cser.open(pwork, args.series, args.version)
elif args.subcmd == 'mark':
diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py
index f2a6ae61ba9..717a2504962 100644
--- a/tools/patman/cseries.py
+++ b/tools/patman/cseries.py
@@ -386,13 +386,16 @@ class Cseries(cser_helper.CseriesHelper):
return summary
- def series_list(self):
+ def series_list(self, include_archived=False):
"""List all series
Lines all series along with their description, number of patches
- accepted and the available versions
+ accepted and the available versions
+
+ Args:
+ include_archived (bool): True to include archived series also
"""
- sdict = self.db.series_get_dict()
+ sdict = self.db.series_get_dict(include_archived)
print(f"{'Name':15} {'Description':40} Accepted Versions")
border = f"{'-' * 15} {'-' * 40} -------- {'-' * 15}"
print(border)
diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py
index c761e0e1f9a..d6cd042e990 100644
--- a/tools/patman/test_cseries.py
+++ b/tools/patman/test_cseries.py
@@ -737,6 +737,30 @@ Tested-by: Mary Smith <msmith at wibble.com> # yak
' 1/3 1 2', lines[3])
self.assertTrue(lines[4].startswith('--'))
+ def test_series_list_archived(self):
+ """Archive a series and test listing it"""
+ self.setup_second()
+ self.cser.archive('first')
+ with terminal.capture() as (out, _):
+ self.run_args('series', 'ls', pwork=True)
+ lines = out.getvalue().splitlines()
+ self.assertEqual(4, len(lines))
+ self.assertEqual(
+ 'second Series for my board '
+ ' 1/3 1 2', lines[2])
+
+ # Now list including archived series
+ with terminal.capture() as (out, _):
+ self.run_args('series', 'ls', '--include-archived', pwork=True)
+ lines = out.getvalue().splitlines()
+ self.assertEqual(5, len(lines))
+ self.assertEqual(
+ 'first '
+ ' -/2 1', lines[2])
+ self.assertEqual(
+ 'second Series for my board '
+ ' 1/3 1 2', lines[3])
+
def test_do_series_add(self):
"""Add a new cseries"""
self.make_git_tree()
--
2.43.0
base-commit: e3ced530e543c9f24cbc66430abc6109ce8df015
branch: pate
More information about the U-Boot
mailing list