3 # Copyright (c) Josef "Jeff" Sipek, 2006-2011
6 USAGE
="[-k] <patchname>"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename $0` directly is no longer supported." >&2
14 if [ "$1" = "-k" ]; then
24 if [ -z "$patch" ]; then
25 die
"No patch name supplied."
28 # make sure it is a file
29 if [ ! -f "$GUILT_DIR/$branch/$patch" ]; then
30 die
"Patch $patch does not exist."
33 # make sure that there are no unapplied changes
34 if ! must_commit_first
; then
35 die
"Uncommited changes detected. Refresh first."
38 # make sure it is not applied
39 pline
=`cat "$applied" | grep -e "^$patch$"`
40 if [ ! -z "$pline" ]; then
41 die
"Patch is applied. Pop the patch first."
46 # back it up just in case :)
47 [ -z "$keep" ] && mv "$GUILT_DIR/$branch/$patch" "$GUILT_DIR/$branch/$patch~"