3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
8 USAGE
="$USAGE [-a | --all | <patchname>]"
17 if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
18 # we are supposed to push all patches, get the last one out of
21 eidx
=`get_series | wc -l`
22 if [ $eidx -eq 0 ]; then
23 echo "There are no patches to push" >&2
26 elif [ -z "$patch" ]; then
27 # we are supposed to push only the next patch onto the stack
29 eidx
=`wc -l < $applied`
32 # we're supposed to push only up to a patch, make sure the patch is
35 eidx
=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
36 if [ $eidx -eq 0 ]; then
37 echo "Patch $patch is not in the series" >&2
42 # make sure that there are no unapplied changes
43 if ! must_commit_first
; then
44 echo "Uncommited changes detected. Refresh first." >&2
48 # now, find the starting patch
49 sidx
=`wc -l < $applied`
53 for p
in `get_series`; do
55 [ $idx -lt $sidx ] && continue
56 [ $idx -gt $eidx ] && break
58 echo "Applying patch..$p"
59 if [ ! -f "$GUILT_DIR/$branch/$p" ]; then
60 echo "Patch $patch does not exist. Aborting." >&2
70 echo "Patch applied with rejects. Fix it up, and refresh." >&2