Makefile update & cleanup
[guilt.git] / guilt-new
blob027cfc54c1d88d59aec6f348d7a64a557c4023fd
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
8 USAGE="$USAGE <patchname>"
10 if [ $# -ne 1 ]; then
11 print_usage
12 exit 1
15 patch="$1"
17 if [ -z "$patch" ]; then
18 print_usage
19 echo "You must specify a patch name"
20 exit 1
23 iidx=`wc -l < $applied`
25 # make sure that there are no unapplied changes
26 if ! must_commit_first; then
27 echo "Uncommited changes detected. Refresh first."
28 exit 1
31 # create the empty patch file
32 touch $GUILT_DIR/$branch/$patch
34 top=`get_top`
36 if [ ! -z "$top" ]; then
37 sed -i -e "s,^$top\$,$top\n$patch," $series
38 else
39 echo "$patch" > $series.tmp
40 cat $series >> $series.tmp
41 mv $series.tmp $series
44 # apply the patch
45 push_patch $patch