[Concept,07/32] patman: Show upstream in series list

Message ID 20260226200106.1727176-8-sjg@u-boot.org
State New
Headers
Series patman: Add multi-upstream support |

Commit Message

Simon Glass Feb. 26, 2026, 8 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Update 'series ls' to display a two-character upstream abbreviation
before the version column, making it easy to see which remote each
series targets.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 tools/patman/cseries.py      |  8 +++++---
 tools/patman/test_cseries.py | 14 +++++++-------
 2 files changed, 12 insertions(+), 10 deletions(-)
  

Patch

diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py
index c90020b7eb6..6c918185387 100644
--- a/tools/patman/cseries.py
+++ b/tools/patman/cseries.py
@@ -408,18 +408,20 @@  class Cseries(cser_helper.CseriesHelper):
             include_archived (bool): True to include archived series also
         """
         sdict = self.db.series_get_dict(include_archived)
-        print(f"{'Name':15}  {'Description':40}  Accepted  Versions")
-        border = f"{'-' * 15}  {'-' * 40}  --------  {'-' * 15}"
+        print(f"{'Name':15}  {'Description':40}  Accepted  Us  Versions")
+        border = f"{'-' * 15}  {'-' * 40}  --------  --  {'-' * 15}"
         print(border)
         for name in sorted(sdict):
             ser = sdict[name]
             versions = self._get_version_list(ser.idnum)
             stat = self._series_get_version_stats(
                 ser.idnum, self._series_max_version(ser.idnum))[0]
+            ups = (ser.upstream or '')[:2]
 
             vlist = ' '.join([str(ver) for ver in sorted(versions)])
 
-            print(f'{name:16.16} {ser.desc:41.41} {stat.rjust(8)}  {vlist}')
+            print(f'{name:16.16} {ser.desc:41.41} {stat.rjust(8)}  '
+                  f'{ups:2}  {vlist}')
         print(border)
 
     def list_patches(self, series, version, show_commit=False,
diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py
index 23527cfa8f0..e529d9fe61b 100644
--- a/tools/patman/test_cseries.py
+++ b/tools/patman/test_cseries.py
@@ -759,14 +759,14 @@  Tested-by: Mary Smith <msmith@wibble.com>   # yak
         self.assertEqual(5, len(lines))
         self.assertEqual(
             'Name             Description                               '
-            'Accepted  Versions', lines[0])
+            'Accepted  Us  Versions', lines[0])
         self.assertTrue(lines[1].startswith('--'))
         self.assertEqual(
             'first                                                      '
-            '     -/2  1', lines[2])
+            '     -/2      1', lines[2])
         self.assertEqual(
             'second           Series for my board                       '
-            '     1/3  1 2', lines[3])
+            '     1/3      1 2', lines[3])
         self.assertTrue(lines[4].startswith('--'))
 
     def test_series_list_archived(self):
@@ -780,7 +780,7 @@  Tested-by: Mary Smith <msmith@wibble.com>   # yak
         self.assertEqual(4, len(lines))
         self.assertEqual(
             'second           Series for my board                       '
-            '     1/3  1 2', lines[2])
+            '     1/3      1 2', lines[2])
 
         # Now list including archived series
         with terminal.capture() as (out, _):
@@ -789,10 +789,10 @@  Tested-by: Mary Smith <msmith@wibble.com>   # yak
         self.assertEqual(5, len(lines))
         self.assertEqual(
             'first                                                      '
-            '     -/2  1', lines[2])
+            '     -/2      1', lines[2])
         self.assertEqual(
             'second           Series for my board                       '
-            '     1/3  1 2', lines[3])
+            '     1/3      1 2', lines[3])
 
     def test_do_series_add(self):
         """Add a new cseries"""
@@ -821,7 +821,7 @@  Tested-by: Mary Smith <msmith@wibble.com>   # yak
         self.assertTrue(lines[1].startswith('--'))
         self.assertEqual(
             'first            my-description                                 '
-            '-/2  1', lines[2])
+            '-/2      1', lines[2])
 
     def test_do_series_add_cmdline(self):
         """Add a new cseries using the cmdline"""