#!/bin/sh
#	This file is part of the Concurrent Versions System CVS.
#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
#	$Header: CV,v 3.1 89/09/25 16:30:31 dick Exp $

#
#		C r e a t e   V e r s i o n
#	CV creates a version of the configuration described by an RCS
#	repository.  This configuration is owned totally by the user and is
#	actually an independent copy, to be dealt with as seen fit.  Once CV
#	has been called in a given directory, it never needs to be called
#	again.  The user can keep up-to-date by calling UV when he feels like
#	it; this will supply him with a merge of his own modifications and
#	the changes made in the RCS original.  See UV for details.
#
#	When the user is satisfied with his own modifications, the
#	present configuration can be committed by CM; this keeps the present
#	configuration in tact.
#
#	The call is
#		CV <repository-name>
#	with preferably the full path name of the RCS repository.
#	CV will then make the initial copy (at RCS speed).
#
#	CV creates a directory ./CVS.adm, in which CVS keeps its
#	administration, in a number of files. Only the file
#	./CVS.adm/Repository is of importance to the user, since it contains
#	the name of the repository.  This file is a normal file and can be
#	edited by the user, if necessary (when the repository is moved, e.g.)
#
Name=CV; export Name

# CVSBIN, CVSLIB and RCSBIN directories
CVSBIN=/home/top/dick/cvs
CVSLIB=/home/top/dick/cvs
RCSBIN=${RCSBIN-/usr/local/bin}
export CVSBIN CVSLIB RCSBIN

# avoid spurious identifications
PATH=${CVSPATH-/bin:/usr/bin}; export PATH

# is the number of parameters correct?
case $# in
1)	# OK
	;;
*)
	echo Call is: $Name repository-name >&2
	exit 1
	;;
esac

Repository=$1

# check the existence of the repository
. $CVSLIB/NR.aux

# create the user administration directory
. $CVSLIB/CA.aux			# uses $Repository

# make dummy entries for files already present, for UV to work on
for User in `$CVSLIB/FN.aux $Repository`
do
	Rcs=$Repository/$User,v
	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
	
	case "$TS_User" in
	"")
		# no problem
		;;
	*)
		# the file is already there, we acknowledge its presence
		$CVSLIB/RG.aux $User $VN_Rcs "Initial $User"
		;;
	esac
done

# call UV
$CVSBIN/UV
