[Concept,11/32] patman: Add get_series_upstream() helper

Message ID 20260226200106.1727176-12-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>

Add a method to look up the upstream for a series by name. If no name
is given, use the current branch. This is needed so that patchwork
commands can find the correct project for the series being operated on.

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

 tools/patman/cser_helper.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
  

Patch

diff --git a/tools/patman/cser_helper.py b/tools/patman/cser_helper.py
index 74bccfcfbc6..a60e02878a5 100644
--- a/tools/patman/cser_helper.py
+++ b/tools/patman/cser_helper.py
@@ -426,6 +426,22 @@  class CseriesHelper:
 
         self.db.pcommit_add_list(svid, to_add)
 
+    def get_series_upstream(self, name):
+        """Get the upstream for a series
+
+        Args:
+            name (str): Name of series, or None to use current branch
+
+        Return:
+            str or None: Upstream name, or None if not found
+        """
+        if not name:
+            name = gitutil.get_branch()
+        ser = self.get_series_by_name(name)
+        if ser:
+            return ser.upstream
+        return None
+
     def get_series_by_name(self, name, include_archived=False):
         """Get a Series object from the database by name