[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rcs->cvs



converting from RCS to CVS is pretty easy since CVS uses RCS format files.

I have a script that traverses a dir tree and extracts all RCS files into
another tree to be copied into CVS.  It is attached.

Warning! not extensively tested.   No warranty.  Use at your own risk etc.

It may not get dot files.  I didn't polish it up much so be kind on
critiques. ;-)


Chuck


On Mon, Oct 02, 2000 at 02:03:53PM -0400, Ray Schneider wrote:
> Heres a quickie....looking for pointers to appropriate docs that have the
> info...Im sure that this can be done....
> 
> Question:
> 
> What needs to be done to take an RCS tree on NT and put it into or rather
> start a CVS tree on linux, hopefully taking into account actively checked
> out or locked files? If that last part is too much of a pain I'll settle
> for links to info on moving existing rcs trees -> cvs trees..
> 
> thanks....most of my docs so far havent really dealt with this, although Im
> sure its a common occurance...
> 
> ray

-- 
Chuck Moss

mossc@mossc.com
#!/bin/ksh

##########################################################################
#
#  $Id: rcs2cvs,v 1.1.1.1 1999/04/10 17:11:05 mossc Exp $
#
#  Description: This script will search through a directory tree and find
#  all the rcs files (,v extension). It will make a copy of the tree
#  containing only RCS files without the RCS subdir.  This can then be
#  imported into cvs just by copying the tree
#
#  Args:        $1 is new root directory for this tree
#
#  Called by: 
#  Calls:
#
#  TODO: 1. echo file as it is copied
#        2. check if file is locked
#
#  $Log: rcs2cvs,v $
#  Revision 1.1.1.1  1999/04/10 17:11:05  mossc
#  general utils
#
#  Revision 1.2  1998/11/09 21:13:48  mossc
#  fixed lock checking logic
#
#
# Revision 1.2  1998/10/27  00:16:32  mossc
# added comments and instructions
#
# Revision 1.1  1998/10/26  23:56:06  mossc
# Initial revision
#
#
##########################################################################

#DEBUG=1
#NEW_ROOT=/tmp/affiliate
NEW_ROOT=$1
CVSROOT=/mnt/cvs

find . -name "*,v" -print |
while read FILE
do
	
	echo "processing file $FILE"
	if `rlog -L -R $FILE | grep $FILE > /dev/null`
	then
		echo "warning $FILE is locked!"
	fi
	echo 
	NEW_FILE=$(echo $FILE | sed 's?RCS/??g' )
	NEW_SUBDIR=$(dirname $NEW_FILE)
	SHORT_FILE=$(basename $NEW_FILE)
	NEW_PATH=$NEW_ROOT/$NEW_SUBDIR

	if [ $DEBUG ]
	then
		echo NEW_FILE=$NEW_FILE
		echo NEW_SUBDIR=$NEW_SUBDIR
		echo SHORT_FILE=$SHORT_FILE
		echo NEW_PATH=$NEW_PATH
		echo mkdir -p $NEW_PATH
		echo cp -p $FILE $NEW_PATH
	else
		if [ ! -d $NEW_PATH ]
		then 
			mkdir -p $NEW_PATH
		fi
		cp -p $FILE $NEW_PATH
	fi
done

echo
echo
echo
echo ' all files copied, if you want to actually move this into CVS'
echo "you now need to move these entire directories to $CVSROOT"
echo 'and change the ownership to root, change the group to cvsgroup'
echo 'and change all directory perms to 775'
echo ' here are the commands:'
echo "mv <module> $CVSROOT"
echo "cd $CVSROOT/<module>"
echo 'chown -R root .'
echo 'chgrp -R cvsgroup .'
echo 'find . -type d -print -exec chmod 775 {} \;'