#!/bin/sh
#
# cvs rename file
#
# written by Markus Neteler 5/2000
# May 30, 2000

if [ $# -lt 3 -o "$1" = "" -o "$1" = "help" -o "$1" = "-h" -o "$1" = "-help" ]
    then
     echo "USAGE: cvs.rename.file old_file_name  new_file_name  comment"
     echo ""
    else
      oldfile=$1
      newfile=$2
      comment=$3
fi
if [ ! "$newfile" ]
then
   exit
fi

# here we go...
if [ -f $newfile ]
then
 echo "file $newfile already exists!"
 exit
fi

mv $oldfile $newfile
cvs rm $oldfile
cvs ci -m"$comment" $oldfile
cvs add $newfile
cvs ci -m"$comment" $newfile

echo "Dont forget to change associated Gmakefiles"
