3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
10 USAGE
="$USAGE [ -f ] [-a | --all | <patchname>]"
12 if [ "$1" == "-f" ]; then
24 if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
25 # we are supposed to push all patches, get the last one out of
28 eidx
=`get_series | wc -l`
29 if [ $eidx -eq 0 ]; then
30 echo "There are no patches to push" >&2
33 elif [ -z "$patch" ]; then
34 # we are supposed to push only the next patch onto the stack
36 eidx
=`wc -l < $applied`
39 # we're supposed to push only up to a patch, make sure the patch is
42 eidx
=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
43 if [ $eidx -eq 0 ]; then
44 echo "Patch $patch is not in the series" >&2
49 # make sure that there are no unapplied changes
50 if ! must_commit_first
; then
51 echo "Uncommited changes detected. Refresh first." >&2
55 # now, find the starting patch
56 sidx
=`wc -l < $applied`
60 for p
in `get_series`; do
62 [ $idx -lt $sidx ] && continue
63 [ $idx -gt $eidx ] && break
65 echo "Applying patch..$p"
66 if [ ! -f "$GUILT_DIR/$branch/$p" ]; then
67 echo "Patch $patch does not exist. Aborting." >&2
71 push_patch
$p $abort_flag
76 elif [ -z "$abort_flag" ]; then
77 echo "Patch applied with rejects. Fix it up, and refresh." >&2
80 echo "To force apply this patch, use 'guilt push -f'" >&2