3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
10 if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
11 # we are supposed to pop all patches
13 sidx
=`wc -l < $applied`
16 elif [ -z "$patch" ]; then
17 # we are supposed to pop only the current patch on the stack
19 sidx
=`wc -l < $applied`
23 # we're supposed to pop only up to a patch, make sure the patch is
26 eidx
=`cat $applied | grep -ne "^$patch\$" | cut -d: -f1`
27 if [ -z "$eidx" ]; then
28 echo "Patch $patch is not in the series/is not applied" >&2
33 sidx
=`wc -l < $applied`
37 # make sure that there are no unapplied changes
38 if ! must_commit_first
; then
39 echo "Uncommited changes detected. Refresh first." >&2
43 idx
=`get_series | wc -l`
44 for p
in `get_series | tac`; do
46 [ $idx -gt $sidx ] && continue
47 [ $idx -lt $eidx ] && break
49 echo "Popping patch...$p"
55 [ ! -z "$p" ] && echo "Now at $p." ||
echo "All patches popped."