summaryrefslogblamecommitdiffstats
path: root/quilt/edit.in
blob: 2b1b2f30f15c326c680430a13dbbb449100d5d63 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                      
                                              

                        
                         

                                                                     
           















































                                                                 
#! @BASH@

#  This script is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License version 2 as
#  published by the Free Software Foundation.
#
#  See the COPYING and AUTHORS files for more details.

: ${EDITOR:=vi}

usage()
{
	printf $"Usage: quilt edit file ...\n"
	if [ x$1 = x-h ]
	then
		printf $"
Edit the specified file(s) in \$EDITOR (%s) after adding it (them) to
the topmost patch.
" "$EDITOR"
		exit 0
	else
		exit 1
	fi
}

options=`getopt -o h -- "$@"`

if [ $? -ne 0 ]
then
	usage
fi

eval set -- "$options"

while true
do
	case "$1" in
	-h)
		usage -h ;;
	--)
		shift
		break ;;
	esac
done

if [ $# -eq 0 ]
then
	usage
fi

bash -c ". @QUILT@/add" "quilt add" "$@"
$EDITOR "$@"
status=$?
for file in "$@"
do
	if ! [ -e "$file" ]
	then
		bash -c ". @QUILT@/remove" "quilt remove" "$file"
		status=1
	fi
done

exit $status
### Local Variables:
### mode: shell-script
### End:
# vim:filetype=sh