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