Daniel Axtens <[email protected]> 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 <[email protected]>
> Signed-off-by: Daniel Axtens <[email protected]>
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")
_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork