[PATCH 2/2] api: allow filtering patches and covers by msgid
Michael Ellerman
mpe at ellerman.id.au
Wed Apr 15 10:51:33 AEST 2020
Daniel Axtens <dja at axtens.net> writes:
> In the process of fixing the previous bug, I realised that:
>
> a) /api/patches/msgid is a perfectly reasonable thing to attempt
> b) We have no way of finding a patch by message id in the API
>
> We can't actualy make /api/patches/msgid work because it may not
> be unique, but we can add a filter.
>
> I'm shoehorning this into stable/2.2, even though it's technically
> an API change: it's minor, not incompatible and in hindsight a
> glaring hole.
>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Signed-off-by: Daniel Axtens <dja at axtens.net>
Thanks, this is awesome.
For reference here's my updated terrible script that I use to apply a
series from a patch id or message id.
cheers
#!/usr/bin/python3
import sys
import requests
from subprocess import check_call
session = requests.Session()
arg = sys.argv[1]
try:
pid = int(arg)
except ValueError:
pid = None
if pid is None:
arg = arg.replace('id:', '')
url = f'https://patchwork.ozlabs.org/api/patches/?msgid={arg}&project=linuxppc-dev'
json = session.get(url).json()[0]
else:
url = f'https://patchwork.ozlabs.org/api/patches/{pid}/'
json = session.get(url).json()
sid = json['series'][0]['id']
cmd = f'git pw series apply {sid}'
check_call(cmd.split())
print("OK")
More information about the Patchwork
mailing list