#!/bin/bash

pwpath=apps/patchwork

if [ "$#" -lt 1 ]
then
	echo "usage: $0 <revspec>" >&2
	exit 1
fi

git rev-list --reverse "$@" |
while read commit
do
	hash=$(git show "$commit" | python $pwpath/parser.py -#)
	$pwpath/bin/pwclient -s Accepted -c "$commit" -h "$hash"
done