#!/bin/csh 

# module_name is the cvs module name
set module_name=papco_scratch_pad_module

# public_area is the directory where the public gets the module,
#   e.g. /opt/hydra/idl_tools/
set public_area=/opt/hydra/papco/

# public_module_name is the name of the subdirectory where the
#   module is to be checked out, which needn't be the same 
#   as the module name.  For instance, the hydra module for
#   papco is papco_hydra_module, but for historical reasons, it
#   is released in a directory within the papco area
#   named polar_hydra.
set public_module_name=scratch_pad

set versiondb=./version_history
if ( ! -f $versiondb ) then
   echo "Can't find hydra_code_version.pro, are you in the root directory?"
   exit
endif

# check to see if there are any files that have not been committed.
set x="`cvs update | grep -v \?`"
if ( "$x" != "" ) then 
    echo "The following files need to be committed:"
    echo "$x"
    exit
endif

# get_next_version looks at ./version_history
set new_vers = v`get_next_version`

echo "New Version number is $new_vers.  "
echo "Please make a note of the changes in emacs."

echo $new_vers >> $versiondb

emacs $versiondb
cvs commit -m "$new_vers" $versiondb

cvs tag $new_vers

cd $public_area
cvs checkout -r $new_vers -d $public_module_name.0 $module_name
rm -rf $public_module_name
mv $public_module_name.0 $public_module_name
chmod 775 $public_module_name
cd $public_module_name
chmod 775 CVS RCS_whoops RCS_whoops/CVS



