diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-06-21 16:17:22 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-06-21 16:17:22 -0400 |
commit | b7d71d8de67bd238f65db6d142a22d7d5a79206d (patch) | |
tree | d125ec42dfe65d63cc066d5974b1ae008c8e5c18 /b4/mbox.py | |
parent | 409c865175bf8f103bf5633331e8a1d77a446814 (diff) | |
download | b4-b7d71d8de67bd238f65db6d142a22d7d5a79206d.tar.gz |
Initial patchwork integration support
A lot of maintainers use patchwork alongside b4, to make it easier to
track patches and rely on some CI integration. This commit adds some
basic patchwork integration:
- on "b4 am", "b4 shazam", "b4 pr" we will mark the relevant patchwork
entries as "Under Review"
- on "b4 ty" we can set these patches as "Accepted"
- on "b4 ty -d" we can set them as "Deferred"
To make it work, the following entries must be present in the repository
used with b4:
[b4]
pw-key = (your API token)
pw-url = https://patchwork.kernel.org
pw-project = (your project, e.g. linux-usb)
pw-review-state = under-review
pw-accept-state = accepted
pw-discard-state = deferred
To get your patchwork API token, go to your patchwork profile page.
The pw-accept-state and pw-discard-state can be overridden using the
--pw-set-state flag to "b4 ty". E.g. if you wanted to mark the patches
as "Not applicable":
b4 ty -d 5 --pw-set-state not-applicable
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/mbox.py')
-rw-r--r-- | b4/mbox.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -20,6 +20,7 @@ import pathlib import tempfile import io import shlex +import argparse import urllib.parse import xml.etree.ElementTree @@ -417,6 +418,7 @@ def thanks_record_am(lser, cherrypick=None): filename = '%s.am' % slug patches = list() + msgids = list() at = 0 padlen = len(str(lser.expected)) lmsg = None @@ -425,6 +427,7 @@ def thanks_record_am(lser, cherrypick=None): if pmsg is None: at += 1 continue + msgids.append(pmsg.msgid) if lmsg is None: lmsg = pmsg @@ -472,6 +475,11 @@ def thanks_record_am(lser, cherrypick=None): json.dump(out, fh, ensure_ascii=False, indent=4) logger.debug('Wrote %s for thanks tracking', filename) + config = b4.get_main_config() + pwstate = config.get('pw-review-state') + if pwstate: + b4.patchwork_set_state(msgids, pwstate) + def save_as_quilt(am_msgs, q_dirname): if os.path.exists(q_dirname): @@ -670,7 +678,7 @@ def get_extra_series(msgs: list, direction: int = 1, wantvers: Optional[int] = N return msgs -def get_msgs(cmdargs) -> Tuple[Optional[str], Optional[list]]: +def get_msgs(cmdargs: argparse.Namespace) -> Tuple[Optional[str], Optional[list]]: msgid = None if not cmdargs.localmbox: msgid = b4.get_msgid(cmdargs) |