
On Tue, Jul 22, 2014 at 09:50:51AM -0400, Tom Rini wrote:
On Wed, Jul 16, 2014 at 07:49:09PM -0700, Brian Norris wrote:
On Thu, Jul 17, 2014 at 11:19:42AM +0900, Masahiro Yamada wrote:
Does Patchwork have any good way to change the status of the whole series?
You can use pwclient via scripts. (I wrote my own hooks for mutt so I can do quicker management straight from my mailbox.)
Oooh, can you share? Thanks!
It's kind of an ugly patchwork (pun!) of Python, shell, etc., so it's not beautiful to share. But the core of it is that I pipe an email to a Python script to extract the Message-ID, then pipe that to pwclient for tasks. Note that the patch "hash" [1] is severely unreliable [2], since it's easy to have collisions; this left me with using e-mail Message-ID, which is much more likely to be unique.
The Python tidbit simplifies to this:
import sys from email import message_from_file print message_from_file(sys.stdin)['Message-Id']
Then some sort of grepping/regex/etc. can get you the patchwork ID from the Message-ID. e.g.:
pwclient list -m "$MESSAGEID" | awk '{print $1;}' | grep '[0-9][0-9]*'
After which you can do your magic with:
pwclient <action> <patchwork ID>
Unfortunately, this is two round trips to the patchwork server, but that's the best I have for now.
My .muttrc has bindings like this:
set pipe_split=yes macro index,pager A "<pipe-message>~/scripts/mutt-patchwork-apply<enter>" macro index,pager S "<pipe-message>~/scripts/mutt-patchwork-status<enter>" macro index,pager I "<pipe-message>~/scripts/mutt-patchwork-info<enter>"
HTH.
Brian
[1] patchwork.git has a parser script (apps/patchwork/parser.py), which can give you the patchwork patch hash:
parser.py --hash
[2] I note the problem with hash collisions here, but I didn't get any response:
https://lists.ozlabs.org/pipermail/patchwork/2014-May/001019.html