#! /bin/sh -pe # take patches from patchwork into bzr # authentication must be in ~/.netrc # TODO: Scan all pending patches and say which ones apply cleanly. # these should be moved into some kind of per-project configuration PWK_ROOT='http://patchwork.ozlabs.org/bazaar-ng' PWK_AUTH_ROOT='https://patchwork.ozlabs.org/bazaar-ng' usage() { cat <<EOF usage: pwk cat PATCH-ID show the patch text pwk try PATCH-ID see if the patch applies cleanly pwk apply PATCH-ID apply patch into current directory EOF } catpatch() { curl --silent --show-error --get -d id=$1 $PWK_ROOT/patchcontent } if [ $# -lt 1 ] then usage exit 1 fi case "$1" in help|-h|--help) usage exit 0 ;; cat) catpatch $2 | ${PAGER:-less} ;; try) catpatch $2 | patch -p1 --dry-run ;; apply) catpatch $2 | patch -p1 ;; *) usage exit 1 esac