moved os-dependant code into per-os files
[guilt.git] / guilt-series
blob9792b72ed1aec8dfaab235f5f3a3b14089d5cf3f
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 git_editor "$series"
26 elif [ ! -z "$gui" ]; then
27 [ -z "`get_top`" ] && die "No patches applied."
28 bottom=`git rev-parse refs/patches/$branch/$(head_n 1 $applied)`
29 top=`git rev-parse refs/patches/$branch/$(tail -n 1 $applied)`
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_full_series
40 else
41 prefix="+"
42 top=`get_top`
44 get_full_series |
45 while read patch; do
46 if [ -z "$top" ]; then
47 disp " $patch"
48 else
49 if [ "$patch" = "$top" ]; then
50 disp "= $patch"
51 prefix=" "
52 elif [ $(check_guards "$patch"; echo $?) -eq 1 ]; then
53 echo " $patch"
54 else
55 disp "$prefix $patch"
58 done