1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#! /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
|