[Concept,28/32] patman: Improve send feedback and upstream list formatting

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

Move the sendemail identity message from upstream lookup to the send
path, so it appears closer to the actual send. Change the Series-to
mismatch from a warning to an error, since sending to the wrong list
is likely unintentional.

Widen the URL column in upstream list to avoid truncation.

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

 tools/patman/cseries.py |  8 +++-----
 tools/patman/send.py    | 11 ++++++++---
 2 files changed, 11 insertions(+), 8 deletions(-)
  

Patch

diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py
index 0f1766f5539..81a8712b3de 100644
--- a/tools/patman/cseries.py
+++ b/tools/patman/cseries.py
@@ -941,8 +941,6 @@  class Cseries(cser_helper.CseriesHelper):
                 identity, series_to, no_maintainers, no_tags = settings
                 if identity and not getattr(args, 'identity', None):
                     args.identity = identity
-                    print(f"Using sendemail identity '{identity}'"
-                          f" from upstream '{ups}'")
                 if series_to:
                     args.series_to = series_to
                 if no_maintainers:
@@ -1220,8 +1218,8 @@  class Cseries(cser_helper.CseriesHelper):
         """
         udict = self.get_upstream_dict()
 
-        print(f"{'Name':6} {'Def':3} {'Project':10} {'URL':40} Options")
-        border = (f"{'-' * 6} {'-' * 3} {'-' * 10} {'-' * 40} "
+        print(f"{'Name':6} {'Def':3} {'Project':10} {'URL':44} Options")
+        border = (f"{'-' * 6} {'-' * 3} {'-' * 10} {'-' * 44} "
                   f"{'-' * 20}")
         print(border)
         for name, items in udict.items():
@@ -1241,7 +1239,7 @@  class Cseries(cser_helper.CseriesHelper):
                 opts.append('no-maintainers')
             if no_tags:
                 opts.append('no-tags')
-            print(f'{name:6} {default:3} {proj_name:10} {url:40} '
+            print(f'{name:6} {default:3} {proj_name:10} {url:44} '
                   f'{" ".join(opts)}')
 
     def upstream_set(self, name, **kwargs):
diff --git a/tools/patman/send.py b/tools/patman/send.py
index 51d2c533540..eb9a8e0da2e 100644
--- a/tools/patman/send.py
+++ b/tools/patman/send.py
@@ -190,8 +190,9 @@  def send(args, git_dir=None, cwd=None):
     if series_to:
         to_list = series.get('to', [])
         if to_list and series_to not in to_list:
-            print(f"WARNING: Series-to tag {to_list} does not include "
-                  f"expected '{series_to}' from upstream settings")
+            raise ValueError(
+                f"Series-to tag {to_list} does not match "
+                f"expected '{series_to}' from upstream settings")
         if not to_list:
             series['to'] = [series_to]
 
@@ -200,12 +201,16 @@  def send(args, git_dir=None, cwd=None):
 
     ok = ok and gitutil.check_suppress_cc_config()
 
+    identity = getattr(args, 'identity', None)
+    if identity:
+        print(f"Using sendemail identity '{identity}'")
+
     its_a_go = ok or args.ignore_errors
     cmd = email_patches(
         col, series, cover_fname, patch_files, args.process_tags,
         its_a_go, args.ignore_bad_tags, args.add_maintainers,
         args.get_maintainer_script, args.limit, args.dry_run,
         args.in_reply_to, args.thread, args.smtp_server,
-        identity=getattr(args, 'identity', None), cwd=cwd)
+        identity=identity, cwd=cwd)
 
     return cmd and its_a_go and not args.dry_run