~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to contrib/pwk

  • Committer: Martin Pool
  • Date: 2005-06-22 03:09:57 UTC
  • Revision ID: mbp@sourcefrog.net-20050622030957-692ff24093ce2a86
- add help, try, apply options to pwk script

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
# authentication must be in ~/.netrc
6
6
 
 
7
# TODO: Scan all pending patches and say which ones apply cleanly.
7
8
 
 
9
# these should be moved into some kind of per-project configuration
8
10
PWK_ROOT='http://patchwork.ozlabs.org/bazaar-ng'
9
11
PWK_AUTH_ROOT='https://patchwork.ozlabs.org/bazaar-ng'
10
12
 
 
13
# bzr uses -p0 style; others use -p1
 
14
PATCH_OPTS='-p0'
 
15
 
11
16
usage() {
12
 
    echo "usage: pwk cat PATCH-ID" >&2
 
17
    cat <<EOF
 
18
usage: 
 
19
   pwk show PATCH-ID       show the patch text
 
20
   pwk try PATCH-ID        see if the patch applies cleanly
 
21
   pwk apply PATCH-ID      apply patch into current directory
 
22
EOF
13
23
}
14
24
 
15
25
catpatch() {
16
 
    curl --get -d id=$1 $PWK_ROOT/patchcontent
 
26
    curl --silent --show-error --get -d id=$1 $PWK_ROOT/patchcontent
17
27
}
18
28
 
19
 
if [ $# -ne 2 ]
 
29
if [ $# -lt 1 ]
20
30
then
21
31
    usage
22
32
    exit 1
24
34
 
25
35
 
26
36
case "$1" in
 
37
help|-h|--help)
 
38
    usage
 
39
    exit 0
 
40
    ;;
27
41
cat)
28
 
    catpatch $2
 
42
    catpatch $2 | ${PAGER:-less}
29
43
    ;;
30
44
try)
31
45
    catpatch $2 | patch -p0 --dry-run
32
46
    ;;
 
47
apply)
 
48
    catpatch $2 | patch -p0
 
49
    ;;
33
50
*)
34
51
    usage
35
52
    exit 1