dwhitney67
October 10th, 2007, 06:59 AM
If you have ever used CVS (or perhaps some other version system), things can get messy if a screw-up occurs when checking-in many files and directories using a script.
Thus I was wondering if anyone with CVS and shell-script experience could critique the following script:
#!/bin/sh
# $1 = path in which to start looking for files
if [ $# -ne 1 ]; then echo "Usage: $0 [dir]"; exit 1; fi
FILES=`find $1`
COMMENT="initial check-in"
for file in $FILES
do
echo Checking in $file...
cvs add $file
if [ -f $file ]
then
cvs commit -m "$COMMENT" $file
fi
done
My main concerns are:
1) Does one need to commit a directory that is being added to CVS?
2) When performing an add/commit on a regular file, should the full-path as reported by "find" be used, or does CVS prefer that the add/commit occur within the directory where the file exists?
Here's an example of what "find" would report for a subdirectory containing a few files:
somedir
somedir/File1
somedir/File2
somedir/FileN
Thus I was wondering if anyone with CVS and shell-script experience could critique the following script:
#!/bin/sh
# $1 = path in which to start looking for files
if [ $# -ne 1 ]; then echo "Usage: $0 [dir]"; exit 1; fi
FILES=`find $1`
COMMENT="initial check-in"
for file in $FILES
do
echo Checking in $file...
cvs add $file
if [ -f $file ]
then
cvs commit -m "$COMMENT" $file
fi
done
My main concerns are:
1) Does one need to commit a directory that is being added to CVS?
2) When performing an add/commit on a regular file, should the full-path as reported by "find" be used, or does CVS prefer that the add/commit occur within the directory where the file exists?
Here's an example of what "find" would report for a subdirectory containing a few files:
somedir
somedir/File1
somedir/File2
somedir/FileN