[Concept,18/29] patman: Rename review series flags to '-s/-S'

Message ID 20260501110040.1874719-19-sjg@u-boot.org
State New
Headers
Series patman: Review-flow improvements and shared helpers |

Commit Message

Simon Glass May 1, 2026, 11 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

The current '-l/--link' and '-t/--title' flags collide with new
flags being added for single-patch reviews ('-p/--patch' and
'-P/--patch-title'). Rename them to '-s/--series' (still landing on
the 'pw_link' attribute, so internal callers are unaffected) and
'-S/--series-title' so the series and patch flag pairs stay
symmetric.

Update the docs and test invocations to match. While here, switch
the rst examples that still write '--create-drafts' to the '-d'
short form added earlier, and tidy up a stray ' - ' that should
be ' -- '.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/cmdline.py      |  6 +++---
 tools/patman/patman.rst      | 16 ++++++++--------
 tools/patman/test_cseries.py | 28 +++++++++++-----------------
 3 files changed, 22 insertions(+), 28 deletions(-)
  

Patch

diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py
index 4ec9df7acb4..06442fc08cc 100644
--- a/tools/patman/cmdline.py
+++ b/tools/patman/cmdline.py
@@ -547,11 +547,11 @@  def add_review_subparser(subparsers):
         'review', aliases=ALIASES['review'],
         help='AI-powered review of a patchwork series')
     review.add_argument(
-        '-l', '--link', type=str, dest='pw_link',
+        '-s', '--series', type=str, dest='pw_link',
         help='Patchwork series link/ID number')
     review.add_argument(
-        '-t', '--title', type=str,
-        help='Search for series by cover-letter title')
+        '-S', '--series-title', type=str, dest='title',
+        help='Search for a series by cover-letter title')
     review.add_argument(
         '-n', '--dry-run', action='store_true', dest='dry_run',
         default=False,
diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
index 0644f4d0e08..70e6b381cc8 100644
--- a/tools/patman/patman.rst
+++ b/tools/patman/patman.rst
@@ -1251,30 +1251,30 @@  Basic usage
 
 Review a series by Patchwork link::
 
-    patman review -l 497923 -U us --reviewer 'Your Name <your@email>'
+    patman review -s 497923 -U us --reviewer 'Your Name <your@email>'
 
 Or search by cover-letter title::
 
-    patman review -t 'boot/bootm: Disable interrupts' -U us \
+    patman review -S 'boot/bootm: Disable interrupts' -U us \
         --reviewer 'Your Name <your@email>'
 
 To create Gmail drafts threaded under the original emails::
 
-    patman review -l 497923 -U us \
+    patman review -s 497923 -U us \
         --reviewer 'Your Name <your@email>' \
-        --create-drafts --gmail-account your@email
+        -d --gmail-account your@email
 
-Use ``-n`` with ``--create-drafts`` for a dry run that shows what would
-be created without calling the Gmail API.
+Use ``-n`` with ``-d`` for a dry run that shows what would be created
+without calling the Gmail API.
 
 Use ``--apply-only`` to download and apply patches without running the
-AI review  - useful for checking that patches apply cleanly.
+AI review -- useful for checking that patches apply cleanly.
 
 Use ``-f`` / ``--force`` to re-review a series that has already been
 reviewed. This deletes the old review records and runs the review
 again::
 
-    patman review -l 497923 -U us -f --reviewer 'Your Name <your@email>'
+    patman review -s 497923 -U us -f --reviewer 'Your Name <your@email>'
 
 If the reviewer email (from ``--reviewer`` or git config) differs from
 the ``--gmail-account``, patman sets the From header on the draft so
diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py
index 125e6db7b69..ea1ac32badc 100644
--- a/tools/patman/test_cseries.py
+++ b/tools/patman/test_cseries.py
@@ -4608,8 +4608,7 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as _:
-                self.run_review( '-l', str(self.REVIEW_LINK),
-                              pwork=pwork)
+                self.run_review('-s', str(self.REVIEW_LINK), pwork=pwork)
 
         # Check the series was created with source='review'
         self.db_open()
@@ -4640,8 +4639,7 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as _:
-                self.run_review( '-l', str(self.REVIEW_LINK),
-                              pwork=pwork)
+                self.run_review('-s', str(self.REVIEW_LINK), pwork=pwork)
 
         # Review the same link again
         mocks = self._mock_review()
@@ -4649,7 +4647,7 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as (out, err):
-                self.run_review('-l', str(self.REVIEW_LINK), pwork=pwork)
+                self.run_review('-s', str(self.REVIEW_LINK), pwork=pwork)
         self.assertIn('Already reviewed', out.getvalue())
 
     def test_review_new_version(self):
@@ -4664,8 +4662,7 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as _:
-                self.run_review( '-l', str(self.REVIEW_LINK),
-                              pwork=pwork)
+                self.run_review('-s', str(self.REVIEW_LINK), pwork=pwork)
 
         # Now review v2 - should detect the previous review
         mocks = self._mock_review()
@@ -4673,8 +4670,7 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as (out, _):
-                self.run_review( '-l', str(self.REVIEW_LINK_V2),
-                              pwork=pwork)
+                self.run_review('-s', str(self.REVIEW_LINK_V2), pwork=pwork)
         self.assertIn('Previously reviewed', out.getvalue())
 
         # Check both versions are under the same series
@@ -4696,8 +4692,7 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as (out, _):
-                self.run_review( '-t', 'Disable interrupts',
-                              pwork=pwork)
+                self.run_review('-S', 'Disable interrupts', pwork=pwork)
         # Should pick the most recent (v2)
         self.assertIn('Using most recent', out.getvalue())
 
@@ -4730,7 +4725,7 @@  Date:   .*
                         return_value='test'), \
              mock.patch('patman.review._git_restore'):
             with terminal.capture() as _:
-                self.run_review('-l', str(self.REVIEW_LINK),
+                self.run_review('-s', str(self.REVIEW_LINK),
                                 pwork=pwork, expect_ret=1)
 
     def test_review_create_drafts_dry_run(self):
@@ -4744,8 +4739,8 @@  Date:   .*
             for m in mocks:
                 stack.enter_context(m)
             with terminal.capture() as (out, _):
-                self.run_review( '-l', str(self.REVIEW_LINK),
-                              '--create-drafts', '-n', pwork=pwork)
+                self.run_review('-s', str(self.REVIEW_LINK), '--create-drafts',
+                                '-n', pwork=pwork)
         output = out.getvalue()
         self.assertIn('Would create draft', output)
         self.assertIn('author@posteo.net', output)
@@ -4773,9 +4768,8 @@  Date:   .*
                         .list.return_value \
                         .execute.return_value = {'messages': []}
                     with terminal.capture() as (out, _):
-                        self.run_review( '-l',
-                                      str(self.REVIEW_LINK),
-                                      '--create-drafts', pwork=pwork)
+                        self.run_review('-s', str(self.REVIEW_LINK),
+                                        '--create-drafts', pwork=pwork)
         output = out.getvalue()
         self.assertIn('Created 1 Gmail draft', output)