repair: new command to repair repository state
[guilt.git] / guilt-series
blob9c34a08485e1ce76a643ab7e30ef240a68a403a8
1 #!/bin/sh
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 USAGE="[-v | -g | -e]"
7 . `dirname $0`/guilt
9 while case "$#" in 0) break ;; esac
11 case "$1" in
12 -v)
13 verbose=t ;;
14 -g)
15 gui=t ;;
16 -e)
17 edit=t ;;
19 usage ;;
20 esac
21 shift
22 done
24 if [ ! -z "$edit" ]; then
25 $editor "$series"
26 elif [ ! -z "$gui" ]; then
27 [ -z "`get_top`" ] && die "No patches applied."
28 bottom=`head -1 $applied | cut -d: -f1`
29 top=`tail -1 $applied | cut -d: -f1`
30 range="$bottom..$top"
32 # FIXME, this doesn't quite work - it's perfectly fine with
33 # git-rev-list, but gitk for whatever reason likes to include the
34 # parent
35 [ "$bottom" = "$top" ] && range="$bottom^..$bottom"
37 gitk $range
38 elif [ -z "$verbose" ]; then
39 get_series
40 else
41 prefix="+"
42 top=`get_top`
44 get_series |
45 while read patch; do
46 if [ -z "$top" ]; then
47 echo " $patch"
48 else
49 if [ "$patch" = "$top" ]; then
50 echo "= $patch"
51 prefix=" "
52 else
53 echo "$prefix $patch"
56 done