~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to contrib/pwk

  • Committer: mbp at sourcefrog
  • Date: 2005-03-19 08:19:38 UTC
  • Revision ID: mbp@sourcefrog.net-20050319081938-596d89f99a644569
use "/usr/bin/env python" for shebang"

Show diffs side-by-side

added added

removed removed

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