[Pkg-bazaar-commits] ./bzr/unstable r730: - add help, try, apply options to pwk script

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:18:51 UTC 2009


------------------------------------------------------------
revno: 730
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-06-22 13:09:57 +1000
message:
  - add help, try, apply options to pwk script
modified:
  contrib/pwk
-------------- next part --------------
=== modified file 'contrib/pwk'
--- a/contrib/pwk	2005-06-20 01:51:01 +0000
+++ b/contrib/pwk	2005-06-22 03:09:57 +0000
@@ -4,19 +4,29 @@
 
 # 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'
 
+# bzr uses -p0 style; others use -p1
+PATCH_OPTS='-p0'
+
 usage() {
-    echo "usage: pwk cat PATCH-ID" >&2
+    cat <<EOF
+usage: 
+   pwk show 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 --get -d id=$1 $PWK_ROOT/patchcontent
+    curl --silent --show-error --get -d id=$1 $PWK_ROOT/patchcontent
 }
 
-if [ $# -ne 2 ]
+if [ $# -lt 1 ]
 then
     usage
     exit 1
@@ -24,12 +34,19 @@
 
 
 case "$1" in
+help|-h|--help)
+    usage
+    exit 0
+    ;;
 cat)
-    catpatch $2
+    catpatch $2 | ${PAGER:-less}
     ;;
 try)
     catpatch $2 | patch -p0 --dry-run
     ;;
+apply)
+    catpatch $2 | patch -p0
+    ;;
 *)
     usage
     exit 1



More information about the Pkg-bazaar-commits mailing list