@@ -54,14 +54,14 @@ def patchwork_status(branch, count, start, end, dest_branch, force,
"""Check the status of patches in patchwork
This finds the series in patchwork using the Series-link tag, checks for new
- comments and review tags, displays then and creates a new branch with the
+ comments and review tags, displays them and creates a new branch with the
review tags.
Args:
branch (str): Branch to create patches from (None = current)
count (int): Number of patches to produce, or -1 to produce patches for
the current branch back to the upstream commit
- start (int): Start partch to use (0=first / top of branch)
+ start (int): Start patch to use (0=first / top of branch)
end (int): End patch to use (0=last one in series, 1=one before that,
etc.)
dest_branch (str): Name of new branch to create with the updated tags
@@ -96,20 +96,9 @@ def patchwork_status(branch, count, start, end, dest_branch, force,
if not links:
raise ValueError("Branch has no Series-links value")
- _, version = patchstream.split_name_version(branch)
- link = series.get_link_for_version(version, links)
- if not link:
- raise ValueError(f'Series-links has no link for v{version}')
- tout.debug(f"Link '{link}")
-
- # Allow the series to override the URL
- if 'patchwork_url' in series:
- url = series.patchwork_url
- pwork = Patchwork(url, single_thread=single_thread)
-
- pwork = Patchwork(url)
- status.check_and_show_status(series, link, branch, dest_branch, force,
- show_comments, False, pwork)
+ status.find_link_and_show_status(
+ series, branch, url, dest_branch, force, show_comments, False,
+ single_thread)
def _setup_patchwork(cser, pwork, ups, pw_url):
@@ -381,6 +381,44 @@ async def check_status(link, pwork, read_comments=False,
read_cover_comments)
+def find_link_and_show_status(series, branch, url, dest_branch, force,
+ show_comments, show_cover_comments,
+ single_thread=False):
+ """Find the patchwork link for a series and show its status
+
+ Resolves the patchwork link from the series metadata, then checks
+ and displays the review status.
+
+ Args:
+ series (Series): Series object for the existing branch
+ branch (str): Branch name (used to determine the version)
+ url (str): Patchwork server URL. Overridden by Series-patchwork-url
+ if present in the series.
+ dest_branch (str): Name of new branch to create, or None
+ force (bool): True to force overwriting dest_branch if it exists
+ show_comments (bool): True to show comments on each patch
+ show_cover_comments (bool): True to show cover letter comments
+ single_thread (bool): True to use a single thread for patchwork
+ """
+ from patman import patchstream
+ from patman.patchwork import Patchwork
+ from u_boot_pylib import tout
+
+ _, version = patchstream.split_name_version(branch)
+ links = series.get('links')
+ link = series.get_link_for_version(version, links)
+ if not link:
+ raise ValueError(f'Series-links has no link for v{version}')
+ tout.debug(f"Link '{link}")
+
+ if 'patchwork_url' in series:
+ url = series.patchwork_url
+ pwork = Patchwork(url, single_thread=single_thread)
+
+ check_and_show_status(series, link, branch, dest_branch, force,
+ show_comments, show_cover_comments, pwork)
+
+
def check_and_show_status(series, link, branch, dest_branch, force,
show_comments, show_cover_comments, pwork,
test_repo=None):