diff options
author | Simon Glass <sjg@chromium.org> | 2020-10-29 21:46:35 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-11-05 09:11:31 -0700 |
commit | dc6df972c9ee2afefd937bee3771865012daccef (patch) | |
tree | 20343d5ae78a420010b60d482dba8e04171a03c1 /tools/patman/control.py | |
parent | be051c0c7741d67f5093f6b61b64c45eb200235b (diff) | |
download | u-boot-dc6df972c9ee2afefd937bee3771865012daccef.zip u-boot-dc6df972c9ee2afefd937bee3771865012daccef.tar.gz u-boot-dc6df972c9ee2afefd937bee3771865012daccef.tar.bz2 |
patman: Support checking for review tags in patchwork
Before sending out a new version of a series for review, it is important
to add any review tags (e.g. Reviewed-by, Acked-by) collected by
patchwork. Otherwise people waste time reviewing the same patch
repeatedly, become frustrated and stop reviewing your patches.
To help with this, add a new 'status' subcommand that checks patchwork
for review tags, showing those which are not present in the local branch.
This allows users to see what new review tags have been received and then
add them.
Sample output:
$ patman status
1 Subject 1
Reviewed-by: Joe Bloggs <joe@napierwallies.co.nz>
2 Subject 2
Tested-by: Lord Edmund Blackaddër <weasel@blackadder.org>
Reviewed-by: Fred Bloggs <f.bloggs@napier.net>
+ Reviewed-by: Mary Bloggs <mary@napierwallies.co.nz>
1 new response available in patchwork
The '+' indicates a new tag. Colours are used to make it easier to read.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/control.py')
-rw-r--r-- | tools/patman/control.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/patman/control.py b/tools/patman/control.py index 6555a40..7a5469a 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -175,3 +175,49 @@ def send(args): its_a_go, args.ignore_bad_tags, args.add_maintainers, args.limit, args.dry_run, args.in_reply_to, args.thread, args.smtp_server) + +def patchwork_status(branch, count, start, end): + """Check the status of patches in patchwork + + This finds the series in patchwork using the Series-link tag, checks for new + comments / review tags and displays them + + 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) + end (int): End patch to use (0=last one in series, 1=one before that, + etc.) + + Raises: + ValueError: if the branch has no Series-link value + """ + if count == -1: + # Work out how many patches to send if we can + count = (gitutil.CountCommitsToBranch(branch) - start) + + series = patchstream.get_metadata(branch, start, count - end) + warnings = 0 + for cmt in series.commits: + if cmt.warn: + print('%d warnings for %s:' % (len(cmt.warn), cmt.hash)) + for warn in cmt.warn: + print('\t', warn) + warnings += 1 + print + if warnings: + raise ValueError('Please fix warnings before running status') + links = series.get('links') + if not links: + raise ValueError("Branch has no Series-links value") + + # Find the link without a version number (we don't support versions yet) + found = [link for link in links.split() if not ':' in link] + if not found: + raise ValueError('Series-links has no current version (without :)') + + # Import this here to avoid failing on other commands if the dependencies + # are not present + from patman import status + status.check_patchwork_status(series, found[0]) |