~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to contrib/pwk

  • Committer: Martin Pool
  • Date: 2005-06-20 04:24:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050620042435-7c315b5a93001b89
- add jk's patchwork client

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.
8
7
 
9
 
# these should be moved into some kind of per-project configuration
10
8
PWK_ROOT='http://patchwork.ozlabs.org/bazaar-ng'
11
9
PWK_AUTH_ROOT='https://patchwork.ozlabs.org/bazaar-ng'
12
10
 
13
11
usage() {
14
 
    cat <<EOF
15
 
usage: 
16
 
   pwk cat PATCH-ID       show the patch text
17
 
   pwk try PATCH-ID        see if the patch applies cleanly
18
 
   pwk apply PATCH-ID      apply patch into current directory
19
 
EOF
 
12
    echo "usage: pwk cat PATCH-ID" >&2
20
13
}
21
14
 
22
15
catpatch() {
23
 
    curl --silent --show-error --get -d id=$1 $PWK_ROOT/patchcontent
 
16
    curl --get -d id=$1 $PWK_ROOT/patchcontent
24
17
}
25
18
 
26
 
if [ $# -lt 1 ]
 
19
if [ $# -ne 2 ]
27
20
then
28
21
    usage
29
22
    exit 1
31
24
 
32
25
 
33
26
case "$1" in
34
 
help|-h|--help)
35
 
    usage
36
 
    exit 0
37
 
    ;;
38
27
cat)
39
 
    catpatch $2 | ${PAGER:-less}
 
28
    catpatch $2
40
29
    ;;
41
30
try)
42
 
    catpatch $2 | patch -p1 --dry-run
43
 
    ;;
44
 
apply)
45
 
    catpatch $2 | patch -p1
 
31
    catpatch $2 | patch -p0 --dry-run
46
32
    ;;
47
33
*)
48
34
    usage
49
35
    exit 1
50
 
esac
 
36
esac
 
 
b'\\ No newline at end of file'