Allow 'guilt foo' commands
[guilt.git] / guilt-new
blob95694570927439d2ea868bf51d561d639e72422a
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt.lib"
8 patch="$1"
10 if [ -z "$patch" ]; then
11 echo "You must specify a patch name"
12 exit 1
13 else
14 iidx=`wc -l < $applied`
17 # make sure that there are no unapplied changes
18 if ! must_commit_first; then
19 echo "Uncommited changes detected. Refresh first."
20 exit 1
23 # create the empty patch file
24 touch $GUILT_DIR/$branch/$patch
26 top=`get_top`
28 if [ ! -z "$top" ]; then
29 sed -i -e "s,^$top\$,$top\n$patch," $series
30 else
31 echo "$patch" > $series.tmp
32 cat $series >> $series.tmp
33 mv $series.tmp $series
36 # apply the patch
37 push_patch $patch
38 echo $patch >> $applied