3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 USAGE
="[ -f ] [-a | --all | <patchname>]"
12 if [ "$1" == "-f" ]; then
23 if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
24 # we are supposed to push all patches, get the last one out of
27 eidx
=`get_series | wc -l`
28 if [ $eidx -eq 0 ]; then
29 die
"There are no patches to push"
31 elif [ -z "$patch" ]; then
32 # we are supposed to push only the next patch onto the stack
34 eidx
=`wc -l < $applied`
37 # we're supposed to push only up to a patch, make sure the patch is
40 eidx
=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
41 if [ -z "$eidx" ]; then
42 die
"Patch $patch is not in the series"
46 # make sure that there are no unapplied changes
47 if ! must_commit_first
; then
48 die
"Uncommited changes detected. Refresh first."
51 # now, find the starting patch
52 sidx
=`wc -l < $applied`
56 for p
in `get_series`; do
58 [ $idx -lt $sidx ] && continue
59 [ $idx -gt $eidx ] && break
61 echo "Applying patch..$p"
62 if [ ! -f "$GUILT_DIR/$branch/$p" ]; then
63 die
"Patch $patch does not exist. Aborting."
66 push_patch
$p $abort_flag
71 elif [ -z "$abort_flag" ]; then
72 die
"Patch applied with rejects. Fix it up, and refresh."
74 die
"To force apply this patch, use 'guilt push -f'"