svn-tools/svkci

55 строки
840 B
Bash
Executable File

#! /bin/bash
FILES=$@
echo "Creating commit message..."
MSG=`mktemp`
svk di $FILES | filterdiff -i'*ChangeLog' |
sed -e '/^[^+]/d' -e 's,^[+],,' -e '/^[^+]/b' -e 's,^[+][+],In,' -e 's,/ChangeLog.*$,:,' -e 's,ChangeLog.*$,.:,' >> $MSG
case $(grep '^In' $MSG | wc -l) in
1) (echo 1d; echo w; echo q) | ed - $MSG ;;
*) ;;
esac
cat $MSG
echo About to commit
svk st $FILES
while [[ 1 ]]
do
read -a RESPONSE -p"Would you like to continue (Y)es/(N)o/(E)dit Message: "
if [[ $? != 0 ]]
then
RESPONSE="N"
fi
case $RESPONSE in
"Y" | "y" | "yes" | "Yes")
echo "Committing..."
svk ci -F $MSG $FILES
rm $MSG
exit 0
;;
"N" | "n" | "no" | "No")
echo "Aborting..."
rm $MSG
exit 1
;;
"E" | "e" | "ed" | "Ed" | "Edit" | "edit")
vi $MSG
# try again
;;
*)
# try again
;;
esac
done