3 # Copyright (c) Josef "Jeff" Sipek, 2006
6 source "`dirname $0`/gq.lib"
10 if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
11 # we are supposed to push all patches, get the last one out of
14 eidx
=`get_series | wc -l`
15 if [ $eidx -eq 0 ]; then
16 echo "There are no patches to push"
19 elif [ -z "$patch" ]; then
20 # we are supposed to push only the next patch onto the stack
22 eidx
=`wc -l < $applied`
25 # we're supposed to push only up to a patch, make sure the patch is
28 eidx
=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
29 if [ $eidx -eq 0 ]; then
30 echo "Patch $patch is not in the series"
35 # make sure that there are no unapplied changes
36 if ! must_commit_first
; then
37 echo "Uncommited changes detected. Refresh first."
41 # now, find the starting patch
42 sidx
=`wc -l < $applied`
47 for p
in `get_series`; do
49 [ $idx -lt $sidx ] && continue
50 [ $idx -gt $eidx ] && break
52 echo "Applying patch..$p"
53 if [ ! -f "$GQ_DIR/$branch/$p" ]; then
54 echo "Patch $patch does not exist. Aborting."
61 # mark patch as applied
65 if [ $bail -eq 0 ]; then
68 echo "Patch applied with rejects. Fix it up, and refresh."