v06i040: CVS, an RCS front-end (cvs), Part1/2

sources-request at mirror.UUCP sources-request at mirror.UUCP
Fri Jul 4 02:46:35 AEST 1986


Submitted by: Dick Grune <seismo!mcvax!vu44!dick>
Mod.sources: Volume 6, Issue 40
Archive-name: cvs/Part1

This is CVS, Concurrent Versions System, a front end for RCS.  It
supports the concurrent and independent use of an RCS directory by
several people.  We have been using it for half a year now, on various
projects.  It uses the RCS programs rcs, ci, co, rcsmerge and rlog in
such a way that you can do a multi-file commit, etc.  It is all shell
scripts.
					Dick Grune
					Vrije Universiteit
					de Boelelaan 1081
					1081 HV  Amsterdam
					the Netherlands


: This is a shar archive.  Extract with sh, not csh.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin
echo Extracting \R\E\A\D\_\M\E
sed 's/^X//' > \R\E\A\D\_\M\E << '+ END-OF-FILE '\R\E\A\D\_\M\E
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: READ_ME,v 1.8 86/06/15 18:03:16 dick Exp $
X
XCVS is an front end for RCS, supporting the concurrent and independent
Xuse of an RCS directory by several people.  See manual page cvs.1.
X
XThis set of shell scripts assumes the presence of the RCS programs
Xrcs, ci, co, rcsmerge and rlog (by Walter Tichy).
X
XTo install, examine the Makefile and give suitable values to:
X
XCVSBIN	the directory for the commands themselves	eg. /usr/local
XCVSLIB	idem for the auxiliaries			eg. /usr/lib/local/cvs
XCVSMAN	idem for the manual page cvs.1			eg. /usr/man/man1
XRCSBIN	the directory that holds the RCS programs	eg. /usr/bin
X
XThen call     make install
X
XBe sure you can write/create:
X	in $(CVSBIN): AE CM CV DF GC LS RM RV SV UV
X	in $(CVSLIB): anything
X	in $(CVSMAN): cvs.1
X
XNOTE:
XIf you have been using CVS already, you may have directories named ".old";
Xthey are now named "Attic".  Please rename any you have before starting to
Xuse this release.
+ END-OF-FILE READ_ME
chmod 'u=rw,g=r,o=r' \R\E\A\D\_\M\E
set `sum \R\E\A\D\_\M\E`
sum=$1
case $sum in
20307)	:;;
*)	echo 'Bad sum in '\R\E\A\D\_\M\E >&2
esac
echo Extracting \M\a\k\e\f\i\l\e
sed 's/^X//' > \M\a\k\e\f\i\l\e << '+ END-OF-FILE '\M\a\k\e\f\i\l\e
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: Makefile,v 1.24 86/06/22 18:12:37 dick Exp $
X
XCVSBIN = /user1/dick/bin#		# where to install the CVS programs
XCVSLIB = /user1/dick/lib/cvs#		# where to install the CVS auxiliaries
XCVSMAN = /user1/dick/man#		# where to install the CVS manual
XRCSBIN = /usr/new#			# where the RCS binaries reside
X
XINF =	READ_ME Makefile Install cvs.1
XPRG =	AE CM CV DF GC LS RM RV SV UV
XAUX =	BE.aux CA.aux CI.aux CS.aux EF.aux FN.aux LR.aux ND.aux NR.aux \
X	OP.aux RG.aux SC.aux SL.aux VN.aux VT.aux
X
Xwhat:
X	@echo "Call is: make [ install | print | shar | clean ]"
X
Xinstall:	install.files $(CVSMAN)/cvs.1
X
Xinstall.files:
X	for F in $(PRG); do ./Install $$F $(CVSBIN) $(CVSLIB) $(RCSBIN); done
X	for F in $(AUX); do ./Install $$F $(CVSLIB) $(CVSLIB) $(RCSBIN); done
X
X$(CVSMAN)/cvs.1:	cvs.1
X	cp cvs.1 $(CVSMAN)/cvs.1
X
X# create a (composite) shar file shar[12]
Xshar:	shar1 shar2
X
Xshar1:	$(INF) $(PRG) Makefile
X	shar $(INF) $(PRG) >shar1
X
Xshar2:	$(AUX) Makefile
X	shar $(AUX) >shar2
X
X# the whole set:
XFLS =	$(INF) ChangeLog $(PRG) $(AUX)
X
Xprint:	$(FLS) Makefile
X	pr $(FLS) >print
X
Xclean:
X	rm -f shar[12] print
X
+ END-OF-FILE Makefile
chmod 'u=rw,g=r,o=r' \M\a\k\e\f\i\l\e
set `sum \M\a\k\e\f\i\l\e`
sum=$1
case $sum in
57177)	:;;
*)	echo 'Bad sum in '\M\a\k\e\f\i\l\e >&2
esac
echo Extracting \I\n\s\t\a\l\l
sed 's/^X//' > \I\n\s\t\a\l\l << '+ END-OF-FILE '\I\n\s\t\a\l\l
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: Install,v 1.9 86/06/13 18:00:24 dick Exp $
X
X#
X#		I n s t a l l
X#	Installs $1 in the directory $2; the file is updated to reflect
X#	that the auxiliaries are in $3 and the RCS binaries in $4.
X#	The directory names $2, $3 and $4 have to be absolute paths.
X#	The pair "[ ... ]", used for testing in more advanced shells, is
X#	replaced by the more portable "test ..."
X#	So, a call might look like
X#		Install GC /usr/local `pwd` /usr/local
X#
X
Xcat $1 |
Xsed "
X	s|^CVSBIN=.*|CVSBIN=$2|
X	s|^CVSLIB=.*|CVSLIB=$3|
X	s|^RCSBIN=.*|RCSBIN=\${RCSBIN-$4}|
X	s|^\([^#]*\)\[ \(.*\) \]|\1test \2|
X" >$2/$1
X
Xchmod +x $2/$1
+ END-OF-FILE Install
chmod 'u=rwx,g=rx,o=rx' \I\n\s\t\a\l\l
set `sum \I\n\s\t\a\l\l`
sum=$1
case $sum in
19502)	:;;
*)	echo 'Bad sum in '\I\n\s\t\a\l\l >&2
esac
echo Extracting \c\v\s\.\1
sed 's/^X//' > \c\v\s\.\1 << '+ END-OF-FILE '\c\v\s\.\1
X.\"	This file is part of the Concurrent Versions System CVS.
X.\"	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X.\"	$Header: cvs.1,v 1.18 86/06/22 18:15:13 dick Exp $
X.TH CVS 1 86/06/14 "Vrije Universiteit"
X.SH NAME
Xcvs \- concurrent-versions system
X.SH SYNOPSIS
X.B CV
XRCS-directory
X.br
X.B UV
X[
X.B \-n
X] [ filename ... ]
X.br
X.B CM
X[
X.B \-n
X] 'log-message' [ filename ... ]
X.br
X.B AE
X[ \-... ] filename ...
X.br
X.B RM
Xfilename ...
X.br
X.B LS
Xfilename ...
X.br
X.B DF
X[ \-... ] [ filename ... ]
X.br
X.B GC
X.br
X.B SV
X.br
X.B RV
XRCS-directory SV-record
X.SH DESCRIPTION
X.I CVS
Xsupports the concurrent use of independent versions of an RCS directory,
Xand as such acts as a front end for RCS.  The user is not required
Xto know RCS commands or ever give them.  The original files of a
Xproject reside in an RCS directory, called the
X.I repository,
Xand are handled by the above commands only. The casual user uses
X.I UV
Xand
X.I CM
Xand may use
X.I CV,
X.I DF
Xand
X.I LS;
Xthe other commands are for maintenance only.
X.PP
XEach participant in the project has his own private copy of the
Xfiles; such a copy is called a
X.I version.
XEach participant can work on his copy at his convenience since it
Xis totally his; the command
X.I UV
X(Update Version)
Xwill merge updates to the repository into his files without
Xdisturbing his own modifications; he can merge his own modifications back
Xinto the repository with the command
X.I CM
X(commit).  Concurrency conflicts, which turn out to be rare anyway,
Xare almost always detected.  The repository is protected by
Xmulti-reader single-writer locks.  There is a simple facility for
Xsubdirectories; see below.
X.PP
X.B Commands.
X.br
X.B CV
X(Create Version) creates a "version" of an RCS repository.  This version
Xis owned totally by the user and is actually an independent
Xcopy, to be dealt with as seen fit.  Once
X.I CV
Xhas been called
Xin a given directory, it never needs to be called again.  The
Xuser can keep up-to-date by calling
X.I UV
Xwhen he feels like it;
Xthis will supply him with a merge of his own modifications
Xand the changes made in the RCS original.  See
X.I UV
Xfor details.
X.PP
XWhen the user is satisfied with his own modifications, the
Xpresent version can be committed by
X.I CM
X(ComMit); this keeps the present
Xversion in tact.
X.PP
XThe call is
X.br
X	CV
X.I repository-name
X.br
Xwith preferably the full path name of the RCS repository.
X.I CV
Xwill then make the initial copy (at RCS speed).  Files in the
Xworking directory with names that also occur in the repository are
Xsupposed to derive already from the RCS files.
X.PP
X.I CV
Xcreates a directory
X.I ./CVS.adm,
Xin which
X.I CVS
Xkeeps its administration, in two files,
X.I Repository
Xand
X.I Entries.
XThe first contains the name
Xof the repository.  The second contains one line for each
Xregistered file, consisting of the version number it derives from,
Xits time stamp at derivation time and its name.  Both files
Xare normal files and can be edited by the user, if need be (when
Xthe repository is moved, e.g.).
X.I CVS
Xmaintains two more files, for user information;
X.I ./CVS.adm/Files
Xcontains the names of the files in the present version;
X.I ./CVS.adm/Mod
Xcontains information about files modified between the latest
X.I CM
Xand the latest
X.I UV.
XThe user can consult these files but modifying them has no effect.
X.PP
X.B UV
X(Update Version) updates the version in the present directory with respect to
Xthe RCS repository.  The present version must have been created by
X.I CV.
XThe call is
X.br
X	UV [ \-n ]
X.br
Xfor a general update, or
X.br
X	UV [ \-n ]
X.I file ...
X.br
Xfor a partial update.
X.PP
XModified or new RCS files are checked out.
XModified user files are reported on standard output
Xas
X.I "M\ user_file."
XIf both the
XRCS file and the user file have been modified, the user file
Xis replaced by the result of
X.I rcsmerge.
XIf this throws up irreconcilable differences, the file is reported as
X.I "C\ user_file,"
Xand as
X.I "M\ user_file"
Xotherwise.
XFiles added but not yet committed are reported as
X.I "A\ user_file."
XFiles removed but not yet decommitted are reported as
X.I "R\ user_file."
X.PP
XIf the present directory contains subdirectories that hold
Xconcurrent versions, these are updated as well.  (See, however,
X.IR CM .)
X.PP
XThe
X.B \-n
Xoption restricts the actions to reporting only.
X.PP
X.B CM
X(ComMit) commits the present version to the RCS repository, AFTER
Xhaving done a test on conflicts.  The call is
X.br
X	CM [ \-n ]
X.I log-message
X.br
Xfor a general commit, and
X.br
X	CM [ \-n ]
X.I "log-message file ..."
X.br
Xfor a (dangerous) partial commit. The
X.I log-message
Xis obligatory, and
Xwill be stored in the repository.
X.PP
XIf the present directory contains subdirectories that hold
Xconcurrent versions, these are NOT committed.  (See, however,
X.IR UV .)
X.PP
XThe
X.B \-n
Xoption restricts the actions to reporting only.
X.PP
X.B AE
X(Add Entries) adds new entries to the
Xpresent version; the options
X.I \-...
Xwill be passed on
Xto
X.I rcs \-i
X(see RCS manual).  For each file it asks for a
Xdescription, in RCS fashion.
XThe entries will be added to the RCS repository upon the
Xnext call of
X.I CM.
XThe user files must already exist.
X.I AE
Xon a file removed with
X.I RM
Xwill resurrect the file, unless its removal has already been
Xcommitted.
X.PP
X.B RM
X(ReMove) marks the entries as removed on purpose from the present version.
XThe RCS files will be actually removed from the RCS repository upon the
Xnext
X.I CM;
Xthey will be moved to a directory
X.I Attic
Xin the repository.
X.PP
X.B LS
Xprints three lines of information for each of its arguments,
Xone for the user file (line 1), one for the newest RCS file
X(line 3) and one for the RCS file both derive from (line 2).
X.PP
X.B DF
Xdoes a nice form of diff(1) on each of its arguments and the
XRCS file that argument derives from.
XIf there are options, these are passed to diff(1) and the diff
Xformat is adhered to; otherwise a more readable format is produced.
XStandard diff(1) format can also be forced by a single \-.
XIf there are no file names, the names of the interesting files
Xare taken from
X.I CVS.adm/Mod
X(which is updated every time
X.I UV
Xis called).  If the option is
X.B \-n,
Xdiff(1) will not be called, but the contents of
X.I CVS.adm/Mod
Xwill be listed instead.
X.PP
X.B GC
X(Garbage Collection) collects garbage, dust & dead wood.  Should be called
Xafter crashes while a
X.IR CVS -program
Xwas running, and other mishaps.
XIt is up to the user to remove (or not!) the files
X.I GC
Xcomplains about.
X.PP
X.B "Saved versions."
X.br
XThe structure of a version, i.e., the revision numbers of its
Xcomponent files, can be saved on a normal file, a
X.I save-record;
Xthe save-record can be used at another time to reconstruct the
Xdescribed version.
X.PP
X.B SV
X(Save Record)
Xwrites a record about the present version (i.e. collection of
Xrevisions) to standard output. This record can, at a later date, be
Xfed to
X.I RV,
Xwhich will then restore the present version; this process
Xrequires the repository again (or still) to be present, though not
Xnecessarily with the same path name.
X.I SV
Xrequires the directory to be quiescent.
X.PP
X.B RV
X(Restore Record) reads the recording made by
X.I SV
Xand restores the version described therein. The call is
X.br
X	RV
X.I "repository-name save-record"
X.br
XThe repository has to exist, but
X.I repository-name
Xneeds not be the same as the one that pertained when
X.I save-record
Xwas made. The files will be
Xreconstructed with the correct revision number, even if they have
Xbeen removed by
X.I RM
Xand
X.I CM
Xin the meantime.
X.PP
XIf a save-record is kept of each distribution sent to a client, the
Xfollowing scenario is useful when the client sends in some
Xcorrections.  In an empty directory, call
X.I RV
Xto reconstruct the client's files.  Apply his corrections.  Call
X.I UV
Xto integrate them with your own innovations.  Call
X.I DF
Xand test, to see if they still make sense.  If satisfied, call
X.I CM
Xand remove the directory.
X.PP
X.B Subdirectories.
X.br
XSince there is no generally accepted structure for RCS directories
Xwith subdirectories, the user is required to set up his own set of
Xsubdirectories and to call
X.I CV
Xin each of them (note that the structure of the user directories
Xneed not be the same as that of the RCS directories).  As long as
Xhis directories form a tree,
X.I UV
Xin the top will update the whole tree.  A corresponding
X.I CM,
Xhowever, will
X.B not
Xcommit the whole tree; each directory will have to be committed
Xseparately.
X.PP
X.B "Setting up"
X.br
XTo set up a repository
X.I repos,
Xmake an empty directory of that name, call
X.I "CV repos,"
Xdo
X.I AE
Xfor each file to go into the repository and finally call
X.I CM
Xto commit the initial version.
X.PP
XTo participate in an existing repository
X.I repos,
Xjust call
X.I "CV repos".
X.PP
XTo turn an existing RCS directory into a repository, you can likewise call
X.I "CV repos",
Xsince no administration is kept in the RCS directory.
XThis works even if both the user files and
Xthe RCS directory already exist (this is useful if you want to start using
X.I CVS
Xfor an existing project).
X.PP
X.B Remarks.
X.br
XTo forcibly stop a running
X.I UV
Xor
X.I CM,
Xsend signal 15 to the top process (\fIkill \-15 <proc-num>\fP); after some
Xseconds it will stop in a more or less reasonable state.
X.PP
XIf either has succumbed to a system crash, act as follows.
XCall
X.I GC
Xand act on its messages until it shuts up.  You can
Xunlock an RCS file that may have been left locked by calling
X.I "rcs -u".
XThen call
X.I UV
Xand act on its messages until it shuts up.  And then call
X.I UV
Xagain (this is necessary to get the time stamps right in some cases).
X.PP
XSince
X.I CVS
Xdoes not keep any information in the repository, it can coexist with
Xother systems or users using raw RCS commands, provided that each
Xalien user leaves the repository consistent.
X.PP
XIf the user version is quiescent (i.e.,
X.I UV
Xgives no output), the user can remove his files with impunity; a
Xsubsequent call of
X.I UV
Xwill restore the full version.
X.SH ENVIRONMENT
X.IP RCSBIN 8
XIf defined: the name of the directory where the RCS programs reside.
XDefault: as determined in the
X.I Makefile.
X.IP CVSPATH 8
XIf defined: the search path for non-RCS programs.  Default:
X.I /bin:/usr/bin.
X.SH FILES
X.ta 30n
X\&./CVS.adm/Repository	holds name of repository
X.br
X\&./CVS.adm/Files	list of file names in the version
X.br
X\&./CVS.adm/Entries	version number and time stamp for each file
X.br
X\&./CVS.adm/Entries.Backup
X.br
X\&./CVS.adm/Mod	names of files modified since last
X.I CM
X(or since
X.IR CV )
X.br
X\&./*,[pt]	options and text for
X.I AE
X.br
X\&Attic	attic for removed files, in the repository
X.br
X\&#cvs.*	multi-reader single-writer locks, in the repository
X.br
Xrcs, ci, co, rcsmerge, rlog	RCS programs
X.SH SEE ALSO
XRCS documentation; rcsintro(1)
X.SH AUTHOR
XDick Grune, Vrije Universiteit, Amsterdam
X.SH DIAGNOSTICS
XBoth
X.I UV
Xand
X.I CM
Xattempt first to make sure that all required actions are possible before
Xdoing any of them.
X.SH DISADVANTAGES
XIf
X.I N
Xusers participate, there will be
X.I N
Xcopies on disk.
X.br
XIt's all shell files and slow.
X.br
X.SH BUGS
XThere is not (yet) a way to work with branches.
X.br
XFunny file names (e.g. containing spaces or *) will give trouble.
X.br
XWeird things happen if the RCS programs cannot be found.
X.br
XDo not run two of the
X.I CVS
Xprograms simultaneously in the same user
Xdirectory; there is no lock-out on the user directory, for
Xefficiency reasons (though there is on the repository).
+ END-OF-FILE cvs.1
chmod 'u=rw,g=r,o=r' \c\v\s\.\1
set `sum \c\v\s\.\1`
sum=$1
case $sum in
33575)	:;;
*)	echo 'Bad sum in '\c\v\s\.\1 >&2
esac
echo Extracting \A\E
sed 's/^X//' > \A\E << '+ END-OF-FILE '\A\E
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: AE,v 1.27 86/06/22 18:08:35 dick Exp $
X
X#
X#		A d d   E n t r y
X#	The call AE [ -... ] filename ... adds new entries to the
X#	present version; the options -... will be passed on
X#	to rcs -i (see RCS manual).  For each file it asks for a
X#	description, in RCS fashion.
X#	The entries will be added to the RCS repository upon the
X#	next call of CM.
X#	The user files must already exist.
X#	AE on a file removed with RM will resurrect the file.
X#
XName=AE; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
X# get possible options
X. $CVSLIB/OP.aux			# sets $Options
X
Xcase $# in
X0)
X	echo Call is: $Name \<options\> filename ... \
X					to add files to present version >&2
X	exit 1
X	;;
Xesac
X
XOK=yes
Xfor User in $@
Xdo
X	Rcs=$Repository/$User,v
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	# what entry is this?
X	case $VN_User in
X	"")
X		# no entry available, $TS_Rcs is invalid
X		
X		# how is the RCS file?
X		case $VN_Rcs in
X		"")
X			# there is no RCS file either
X			
X			# how is the user file?
X			case "$TS_User" in
X			"")
X				# there is no user file
X				echo $Name: nothing known about $User >&2
X				OK=no
X				;;
X			*)
X				# there is a user file
X				. $CVSLIB/BE.aux	# build entry
X				;;
X			esac
X			;;
X		*)
X			# there is an RCS file
X			
X			# illegal addition
X			echo $Name: $User added independently \
X							by second party >&2
X			OK=no
X			;;
X		esac
X		;;
X	
X	0)
X		# an entry for a new-born file, $TS_Rcs is dummy
X		
X		# but that is inappropriate here
X		echo $Name: $User has already been entered >&2
X		OK=no
X		;;
X	
X	-*)
X		# an entry for a removed file, $TS_Rcs is valid
X		
X		# how is the user file?
X		case "$TS_User" in
X		"")
X			# there is no user file (as it should be)
X			
X			# how is the RCS file?
X			case -$VN_Rcs in
X			-)
X				# there is no RCS file
X			
X				# it has already been removed
X				echo $Name: cannot resurrect $User, \
X					RCS file removed by second party >&2
X				OK=no
X				;;
X			*)
X				# there is an RCS file
X				
X				# resurrection requested
X				# remove initial minus from $VN_User
X				VN_User=`expr $VN_User : '-\(.*\)' `
X				$CVSLIB/RG.aux $User $VN_User \
X							"Resurrected $User"
X				if	# we can restore the copy
X					$CVSBIN/UV $User
X				then
X					echo $Name: $User, version $VN_User, \
X						resurrected >&2
X				else
X					echo $Name: could not \
X							resurrect $User >&2
X					OK=no
X				fi
X				;;
X			esac
X			;;
X		*)
X			# user file shouldn't be there
X			echo $Name: $User should be removed \
X				and is still there >&2
X			OK=no
X			;;
X		esac
X		;;
X	
X	*)
X		# a normal entry, $TS_Rcs is valid
X		
X		# illegal addition
X		echo $Name: $User already exists, \
X			with version number $VN_User >&2
X		OK=no
X		;;
X	esac
Xdone
X
X$CVSLIB/EF.aux				# update CVS.adm/Files
X
X# did we succeed?
Xcase $OK in
Xno)
X	exit 1
X	;;
Xesac
X
Xexit 0
+ END-OF-FILE AE
chmod 'u=rwx,g=rx,o=rx' \A\E
set `sum \A\E`
sum=$1
case $sum in
54667)	:;;
*)	echo 'Bad sum in '\A\E >&2
esac
echo Extracting \C\M
sed 's/^X//' > \C\M << '+ END-OF-FILE '\C\M
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: CM,v 1.41 86/06/22 18:09:47 dick Exp $
X
X#
X#		C o m m i t
X#	CM commits the present version to the RCS repository, AFTER
X#	having done a test on conflicts.  The call is
X#		CM [ -n ] 'log-message'
X#	for a general commit, and
X#		CM [ -n ] 'log-message' file ...
X#	for a (dangerous) partial commit.
X#
X#	If the present directory contains subdirectories that hold
X#	concurrent versions, these are NOT committed too.  (See, however, UV.)
X#
X#	The -n option restricts the actions to reporting only.
X#
XName=CM; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
X# to ACT or not to ACT, that is the question
Xcase "$1" in
X-n)
X	ACT=echo
X	shift
X	;;
X*)
X	ACT=
X	;;
Xesac
X
XMessage="$1"
Xif	# there was no message
X	[ "$Message" = "" ] \
X||	# it was a file name
X	[ -r "$Message" ]
Xthen
X	echo $Name: no modification message! >&2
X	exit 1
Xfi
Xshift
X
X#	A T T E M P T   E X C L U S I V E   W R I T E   A C C E S S
X
XLDR=$Repository				# the directory
XLCK=$LDR/\#cvs.lock			# the lock
XTFL=$LDR/\#cvs.tfl			# a temporary test file
XRFL=$LDR/\#cvs.rfl			# pattern of the read flags
XWFL=$LDR/\#cvs.wfl			# the general write flag
X
X# attempt write access at all
Xif	# we can write at all
X	cp /dev/null $TFL >/dev/null 2>/dev/null
Xthen	# okay so far
X	rm $TFL
Xelse	# not so okay
X	echo $Name: you have no write permission in $LDR >&2
X	exit 1
Xfi
X
X# set lock
X. $CVSLIB/SL.aux			# persistently tries to mkdir $LCK
X
X# set trap to remove flag and lock on interrupt and exit
Xtrap 'rm -f $WFL; rmdir $LCK; exit' 0 1 2 3 15
X
X#	C R I T I C A L   S E C T I O N
X
X# notify others of intention
Xcp /dev/null $WFL			# plant write flag
X
X# wait for the readers to disappear
Xwhile	# there are still read flags
X	[ "`echo $RFL.* | grep -v '\*'`" != "" ]
Xdo
X	echo $Name: `date`: waiting for readers to disappear
X	sleep 60
Xdone
X
X#	W R I T E   I N   S A F E T Y
X
X# determine the way we are called
Xcase $# in
X0)
X	# no file names: treat all pertinent files
X	set "`$CVSLIB/FN.aux $Repository`"
X	$ACT cp /dev/null CVS.adm/Mod
X	;;
Xesac
X
X# collect the sets of affected files
X
XOK=yes
X. $CVSLIB/CS.aux	# sets CLIST, GLIST, MLIST, OLIST, ALIST, RLIST, WLIST
X
Xcase $OK in
Xno)
X	# this checks for CLIST as well, since CLIST != "" <-> OK=no
X	exit 1
Xesac
X
X# everything up to date?
Xcase "$GLIST$OLIST$WLIST" in
X"")
X	;;
X*)
X	echo $Name: the following files are not up to date\; use UV first >&2
X	echo $GLIST$OLIST$WLIST >&2
X	exit 1
X	;;
Xesac
X
X# is there anything to do in the first place?
Xcase "$MLIST$RLIST$ALIST" in
X"")
X	echo $Name: there is nothing to commit! >&2
X	exit 1
X	;;
Xesac
X
X# try to get exclusive control of all files to be affected
XOK=yes
Xfor User in $MLIST $RLIST
Xdo
X	Rcs=$Repository/$User,v
X		
X	if	# we can lock $Rcs
X		$ACT $RCSBIN/rcs -q -l $Rcs
X	then	# add it to the list LLIST
X		LLIST="$LLIST $User"
X	else
X		echo $Name: could not lock $Rcs >&2
X		OK=no
X	fi
Xdone
X
X# try to create all files in the add list
Xfor User in $ALIST
Xdo
X	Rcs=$Repository/$User,v
X	
X	if	# create $Rcs, using the description files $User,[pt]
X		$ACT $RCSBIN/rcs -i `cat $User,p` -t$User,t $Rcs
X	then	:
X	else	# something is wrong
X		echo $Name: could not create $Rcs >&2
X		OK=no
X	fi
Xdone
X
X# did we succeed?
Xcase $OK in
Xno)
X	# something failed; release all locked files & remove all added files
X	for User in $LLIST
X	do	# unlock the RCS file
X		Rcs=$Repository/$User,v
X		if	# unlock $Rcs
X			$ACT $RCSBIN/rcs -q -u $Rcs
X		then	:
X		else	# something very wrong
X			echo $Name: could not UNlock $Rcs >&2
X		fi
X	done
X	
X	for User in $ALIST
X	do	# remove the newly created RCS file
X		Rcs=$Repository/$User,v
X		$ACT rm -f $Rcs
X	done
X	
X	# and give up
X	exit 1
X	;;
Xesac
X
X# got them all; now go ahead!
X
X# add the files in the ALIST
X
X# get revision level
XRevision=-r`
X	<CVS.adm/Entries sed 's/[.|].*//' |
X	sort -nr |
X	sed '1q'
X`
Xif	# there are initial entries only
X	[ X$Revision = X-r0 ]
Xthen	# make it level 1
X	Revision=-r1
Xfi
X
Xfor User in $ALIST			# with $Revision set
Xdo
X	. $CVSLIB/CI.aux		# a careful check-in; may set OK=no
X	$ACT rm -f $User,[pt]		# throw away the info files from AE
Xdone
X
X# modify the files in the MLIST
XRevision=""
Xfor User in $MLIST			# with $Revision empty
Xdo
X	. $CVSLIB/CI.aux		# a careful check-in; may set OK=no
Xdone
X
X# remove the RCS files in the RLIST
Xfor User in $RLIST
Xdo
X	Rcs=$Repository/$User,v
X	Old=$Repository/Attic/$User,v
X	
X	$ACT mkdir $Repository/Attic >/dev/null 2>/dev/null
X	if	# we could move RCS file away
X		(	# we can unlock $Rcs
X			$ACT $RCSBIN/rcs -u -q $Rcs \
X		&&	# we can move it away
X			$ACT mv $Rcs $Old
X		) \
X	||	# the file was already removed
X		( [ ! -r $Rcs -a -r $Old ] )
X	then	# scratch the entry as well
X		$ACT $CVSLIB/SC.aux $User
X	else
X		echo $Name: attempt to move $Rcs to $Old failed >&2
X		OK=no
X	fi
Xdone
X
X# did we succeed?
Xcase $OK in
Xno)
X	exit 1
X	;;
Xesac
X
Xexit 0
+ END-OF-FILE CM
chmod 'u=rwx,g=rx,o=rx' \C\M
set `sum \C\M`
sum=$1
case $sum in
13212)	:;;
*)	echo 'Bad sum in '\C\M >&2
esac
echo Extracting \C\V
sed 's/^X//' > \C\V << '+ END-OF-FILE '\C\V
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: CV,v 1.19 86/06/22 18:10:31 dick Exp $
X
X#
X#		C r e a t e   V e r s i o n
X#	CV creates a "version" of an RCS repository.  This version
X#	is owned totally by the user and is actually an independent
X#	copy, to be dealt with as seen fit.  Once CV has been called
X#	in a given directory, it never needs to be called again.  The
X#	user can keep up-to-date by calling UV when he feels like it;
X#	this will supply him with a merge of his own modifications
X#	and the changes made in the RCS original.  See UV for details.
X#
X#	When the user is satisfied with his own modifications, the
X#	present version can be committed by CM; this keeps the present
X#	version in tact.
X#
X#	The call is
X#		CV <repository-name>
X#	with preferably the full path name of the RCS repository.
X#	CV will then make the initial copy (at rcs speed).
X#
X#	CV creates a directory ./CVS.adm, in which it keeps its
X#	administration, in two files, Repository and Entries.
X#	The first contains the name of the repository.  The second
X#	contains one line for each registered file,
X#	consisting of the version number it derives from,
X#	its time stamp at derivation time and its name.  Both files
X#	are normal files and can be edited by the user, if necessary (when
X#	the repository is moved, e.g.)
X#
XName=CV; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# is the call correct?
Xcase $# in
X1)
X	# the number of parameters is alright; prepare for CA.aux
X	Repository=$1
X	InitRecord=/dev/null
X	;;
X*)
X	echo $Name: call is $Name \<repository-name\> >&2
X	exit 1
X	;;
Xesac
X
X# create the administration directory
X. $CVSLIB/CA.aux			# uses $Repository and $InitRecord
X
X# make dummy entries for files already present, for UV to work on
Xfor User in `$CVSLIB/FN.aux $Repository`
Xdo
X	Rcs=$Repository/$User,v
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	case "$TS_User" in
X	"")
X		# no problem
X		;;
X	*)
X		# the file is already there, we acknowledge its presence
X		$CVSLIB/RG.aux $User $VN_Rcs "Initial $User"
X		;;
X	esac
Xdone
X
X# call UV
X$CVSBIN/UV
+ END-OF-FILE CV
chmod 'u=rwx,g=rx,o=rx' \C\V
set `sum \C\V`
sum=$1
case $sum in
53592)	:;;
*)	echo 'Bad sum in '\C\V >&2
esac
echo Extracting \D\F
sed 's/^X//' > \D\F << '+ END-OF-FILE '\D\F
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: DF,v 1.22 86/06/22 18:11:14 dick Exp $
X
X#
X#		D i f f e r e n c e
X#	Does a nice form of diff(1) on each of its arguments and the
X#	RCS file it derives from.
X#	The call is
X#		DF <options> [ file-name ... ]
X#	If there are <options>, these are passed to diff(1) and the diff
X#	format is adhered to; otherwise a more readable format is produced.
X#	Standard diff(1) format can also be forced by a single -.
X#	If there are no file names, the names of the interesting files
X#	are taken from CVS.adm/Mod.  If the option is -n, diff(1) will not
X#	be called, but the contents of CVS.adm/Mod will be listed instead.
X#
XName=DF; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
X# get possible options
X. $CVSLIB/OP.aux			# sets $Options
X
X# special cases
Xcase "$Options" in
X" -")
X	# single -, just plain old diff
X	Options=" "
X	;;
X" -n")
X	# no diff at all, just show contents of CVS.adm/Mod
X	cat CVS.adm/Mod
X	exit 0
X	;;
Xesac
X
X# determine the way we are called
Xcase $# in
X0)
X	# no file names: read CVS.adm/Mod
X	if	# CVS.adm/Mod is empty
X		[ ! -s CVS.adm/Mod ]
X	then
X		echo $Name: no modifications to report
X		exit 0
X	fi
X	set `cat CVS.adm/Mod`
X	;;
Xesac
X
Xfor User in $@
Xdo
X	. $CVSLIB/LR.aux	# sets $Rcs to $Repository/$User,v or /Attic/
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	# what entry is this?
X	case $VN_User in
X	"")
X		# no entry available, $TS_Rcs is invalid
X		
X		echo $Name: I know nothing about $User >&2
X		continue
X		;;
X	
X	0)
X		# an entry for a new-born file, $TS_Rcs is dummy
X		
X		echo $Name: $User is a new entry, no comparison available >&2
X		continue
X		;;
X	
X	-*)
X		# an entry for a removed file, $TS_Rcs is valid
X		
X		echo $Name: $User was removed, no comparison available >&2
X		continue
X		;;
X	
X	*)
X		# a normal entry, $TS_Rcs is valid
X		
X		# how is the RCS file?
X		case $VN_Rcs in
X		"")
X			# there is no RCS file
X			
X			echo $Name: cannot find $Rcs >&2
X			continue
X			;;
X		*)
X			# there is an RCS file
X			
X			# how is the user file?
X			case "$TS_User" in
X			"")
X				# there is no user file
X				echo $Name: cannot find $User >&2
X				continue
X				;;
X			esac
X			;;
X		esac
X		;;
X	esac
X
X	echo FILE $User VERSUS $Rcs, version $VN_User
X	$RCSBIN/co -p -q -r$VN_User $Rcs |
X	diff $Options $User - |
X	case "$Options" in
X	"")
X		# nothing special, user seems to like my taste in diffs
X		sed '
X			s/^[1-9][0-9]*/&/
X			s/.*//
X			s/^[1-9]/\
XAT &/
X			s/^> /WAS:	/
X			s/^< /NEW:	/
X		'
X		;;
X	*)
X		# have it you own way
X		cat
X		;;
X	esac
X	echo ''
X
Xdone
+ END-OF-FILE DF
chmod 'u=rwx,g=rx,o=rx' \D\F
set `sum \D\F`
sum=$1
case $sum in
25951)	:;;
*)	echo 'Bad sum in '\D\F >&2
esac
echo Extracting \G\C
sed 's/^X//' > \G\C << '+ END-OF-FILE '\G\C
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: GC,v 1.25 86/06/22 18:11:33 dick Exp $
X
X#
X#		G a r b a g e   C o l l e c t i o n
X#	Collects garbage, dust & dead wood.  Should be called after
X#	crashes while a CVS-program was running, and other mishaps.
X#
XName=GC; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
XTmp1=CVS.adm/GC.1
XTmp2=CVS.adm/GC.2
X
X# are there duplicates in the CVS.adm/Entries file?
Xcat CVS.adm/Entries |
Xsed 's/.* \(.*\)|/\1/' |
Xsort |
Xuniq -c |
Xgrep -v ' 1 ' >$Tmp1
Xif	# this yielded something
X	[ -s $Tmp1 ]
Xthen	# report
X	echo $Name: duplicates in CVS.adm/Entries:
X	cat $Tmp1
Xfi
X
X# try to find garbage in CVS.adm
Xls CVS.adm |
Xsed '
X	/^Entries$/d
X	/^Entries.Backup$/d
X	/^Files$/d
X	/^Mod$/d
X	/^Repository$/d
X	/^GC.[12]$/d
X' >$Tmp1
Xif	# this yielded something
X	[ -s $Tmp1 ]
Xthen	# report
X	echo $Name: garbage in directory CVS.adm:
X	cat $Tmp1 |
X	sed 's/^/	CVS.adm\//'
X	echo ''
Xfi
X
X# try to find locked files in the repository
X(
X	cd $Repository
X	$RCSBIN/rlog -Lh *,v
X)
X
X# try to find garbage left-over by RCS
Xls -d ,* $Repository/,* |
Xsed '
X	/not found/d
X' >$Tmp1
Xif	# this yielded something
X	[ -s $Tmp1 ]
Xthen	# report
X	echo $Name: RCS left-overs found:
X	cat $Tmp1 |
X	sed 's/^/	/'
X	echo ''
Xfi
X
X# try to find left-over locks & flags
Xecho $Repository/\#cvs.* |
Xgrep -v '\*' >$Tmp1
Xif	# this yielded something
X	[ -s $Tmp1 ]
Xthen	# such garbage exists
X	echo $Name: left-over flags and locks found:
X	cat $Tmp1 |
X	sed 's/^/	/'
X	echo ''
Xfi
X
Xrm -f $Tmp1 $Tmp2
+ END-OF-FILE GC
chmod 'u=rwx,g=rx,o=rx' \G\C
set `sum \G\C`
sum=$1
case $sum in
55596)	:;;
*)	echo 'Bad sum in '\G\C >&2
esac
echo Extracting \L\S
sed 's/^X//' > \L\S << '+ END-OF-FILE '\L\S
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: LS,v 1.20 86/06/22 18:12:16 dick Exp $
X
X#
X#		L i s t   i n f o r m a t i o n
X#	Prints three lines of information for each of its arguments,
X#	one for the user file (line 1), one for the newest RCS file
X#	(line 3) and one for the RCS file both derive from (line 2).
X#
XName=LS; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
Xfor User in $@
Xdo
X	. $CVSLIB/LR.aux	# sets $Rcs to $Repository/$User,v or /Attic/
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	case "$TS_User" in
X	"")
X		echo "User:	no user file $User"
X		;;
X	*)
X		echo "User:		$TS_User"
X		;;
X	esac
X	
X	case $VN_User in
X	"")
X		echo "From:	no entry for $User"
X		;;
X	0)
X		# a new file
X		echo "From:	new	message: `<$User,t sed '1!d'`"
X		;;
X	*)
X		echo "From:	$VN_User	$TS_Rcs"
X		;;
X	esac
X	
X	case $VN_Rcs in
X	"")
X		echo "RCS:	no $Rcs"
X		;;
X	*)
X		echo "RCS:	$VN_Rcs	$Rcs"
X		;;
X	esac
X	echo ''
Xdone
+ END-OF-FILE LS
chmod 'u=rwx,g=rx,o=rx' \L\S
set `sum \L\S`
sum=$1
case $sum in
63035)	:;;
*)	echo 'Bad sum in '\L\S >&2
esac
echo Extracting \R\M
sed 's/^X//' > \R\M << '+ END-OF-FILE '\R\M
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: RM,v 1.15 86/06/22 18:13:33 dick Exp $
X
X#
X#		R e m o v e   E n t r y
X#	RM filename ... : removes entries from the present version.
X#	The entries will be removed from the RCS repository upon the
X#	next CM.
X#
XName=RM; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
Xcase $# in
X0)
X	echo Call is: $Name filename ... \
X				to remove files from present version >&2
X	exit 1
X	;;
Xesac
X
XOK=yes
Xfor User in $@
Xdo
X	Rcs=$Repository/$User,v
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	# $User may still exist
X	case "$TS_User" in
X	"")
X		;;
X	*)
X		echo $Name: $User still exists >&2
X		OK=no
X		continue
X		;;
X	esac
X	
X	# check its status
X	case $VN_User in
X	"")
X		echo $Name: there is no entry for $User >&2
X		OK=no
X		;;
X	0)
X		# killed in the cradle
X		$CVSLIB/SC.aux $User
X		rm -f $User,?
X		;;
X	-*)
X		echo $Name: $User was already removed >&2
X		OK=no
X		;;
X	*)
X		# a full-grown entry; set it to removed
X		$CVSLIB/RG.aux $User -$VN_User "$TS_Rcs"
X		;;
X	esac
Xdone
X
X$CVSLIB/EF.aux				# update CVS.adm/Files
X
X# did we succeed?
Xcase $OK in
Xno)
X	exit 1
X	;;
Xesac
X
Xexit 0
+ END-OF-FILE RM
chmod 'u=rwx,g=rx,o=rx' \R\M
set `sum \R\M`
sum=$1
case $sum in
14142)	:;;
*)	echo 'Bad sum in '\R\M >&2
esac
echo Extracting \R\V
sed 's/^X//' > \R\V << '+ END-OF-FILE '\R\V
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: RV,v 1.10 86/06/22 18:13:52 dick Exp $
X
X#
X#		R e s t o r e   V e r s i o n
X#	RV reads the recording made by SV and restores the version described
X#	therein. The call is
X#		RV <repository-name> <SV-record>
X#	The repository has to exist, but <repository-name> needs not be the
X#	same as the one that pertained when SV was done. The files will be
X#	reconstructed with the correct revision number, even if they have
X#	been removed by RM in the meantime.
XName=RV; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# is the call correct?
Xcase $# in
X2)
X	# the number of parameters is alright; register them for CA.aux
X	Repository=$1
X	InitRecord=$2
X	;;
X*)
X	# wrong number of parameters
X	echo $Name: call is $Name \<repository-name\> \<SV-record\> >&2
X	exit 1
X	;;
Xesac
X
X# create the administration directory
X. $CVSLIB/CA.aux			# uses $Repository and $InitRecord
X
X# construct list of files to check out
XOLIST=` <CVS.adm/Entries sed 's/.* \(.*\)|/\1/' `
X
X# see if any is already present
XOK=yes
Xfor User in $OLIST
Xdo
X	if	# there is a file $User already
X		[ -f $User ]
X	then
X		echo $Name: $User already exists >&2
X		OK=no
X	fi
Xdone
X
Xcase $OK in
Xno)
X	echo $Name failed\; correct above errors first >&2
X	exit 1
X	;;
Xesac
X
X# check out all files in $OLIST
Xfor User in $OLIST
Xdo
X	. $CVSLIB/LR.aux	# sets $Rcs to $Repository/$User,v or /Attic/
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	# how is the RCS file?
X	case $VN_Rcs in
X	"")
X		# there is no RCS file
X		
X		echo $Name: cannot find $Rcs >&2
X		OK=no
X		continue
X		;;
X	*)
X		# there is an RCS file
X		
X		if	# check out correct version of $Rcs into $User
X			$RCSBIN/co -r$VN_User $Rcs $User
X		then	# adjust $User
X			chmod +w $User
X			# make a reference with the NEW time stamp
X			# and the OLD version number
X			. $CVSLIB/VT.aux
X			$CVSLIB/RG.aux $User $VN_User "$TS_User"
X		else
X			echo $Name: could not check out $User >&2
X			OK=no
X		fi
X		;;
X	esac
Xdone
X
X$CVSLIB/EF.aux				# update CVS.adm/Files
X
X# did we succeed?
Xcase $OK in
Xno)
X	exit 1
X	;;
Xesac
X
Xexit 0
+ END-OF-FILE RV
chmod 'u=rwx,g=rx,o=rx' \R\V
set `sum \R\V`
sum=$1
case $sum in
36697)	:;;
*)	echo 'Bad sum in '\R\V >&2
esac
echo Extracting \S\V
sed 's/^X//' > \S\V << '+ END-OF-FILE '\S\V
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: SV,v 1.6 86/06/22 18:14:30 dick Exp $
X
X#
X#		S a v e   V e r s i o n
X#	SV writes a record about the present version (i.e. collection of
X#	revisions) to standard output. This record can, at a later date, be
X#	fed to RV, which will then restore the present version; this process
X#	requires the repository again (or still) to be present, though not
X#	necessarily with the same path name.
X#
X#	SV requires the directory to be quiescent.
X#
XName=SV; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
X# determine the way we are called
Xcase $# in
X0)
X	# treat all pertinent files
X	set "`$CVSLIB/FN.aux $Repository`"
X	;;
X*)
X	echo $Name: call is $Name \>save.record >&2
X	exit 1
X	;;
Xesac
X
X# collect the sets of affected files
X
XOK=yes
X. $CVSLIB/CS.aux	# sets CLIST, GLIST, MLIST, OLIST, ALIST, RLIST, WLIST
X
Xcase $OK in
Xno)
X	echo $Name failed\; correct above errors first >&2
X	exit 1
Xesac
X
X# is the directory quiescent?
Xcase "$CLIST$GLIST$MLIST$OLIST$ALIST$RLIST$WLIST" in
X"")
X	;;
X*)
X	echo $Name: the following files are not up to date: >&2
X	echo "$CLIST$GLIST$MLIST$OLIST$ALIST$RLIST$WLIST" >&2
X	exit 1
X	;;
Xesac
X
X# now it is easy:
Xcat CVS.adm/Entries
X
Xexit 0
+ END-OF-FILE SV
chmod 'u=rwx,g=rx,o=rx' \S\V
set `sum \S\V`
sum=$1
case $sum in
01288)	:;;
*)	echo 'Bad sum in '\S\V >&2
esac
echo Extracting \U\V
sed 's/^X//' > \U\V << '+ END-OF-FILE '\U\V
X#!/bin/sh
X#	This file is part of the Concurrent Versions System CVS.
X#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
X#	$Header: UV,v 1.31 86/06/22 18:14:46 dick Exp $
X
X#
X#		U p d a t e   V e r s i o n
X#	UV updates the version in the present directory with respect to
X#	the RCS repository.  The present version must have been created by CV.
X#	The user can keep up-to-date by calling UV whenever he feels like it.
X#	The present version can be committed by CM, but this keeps the
X#	version in tact.
X#
X#	The call is
X#		UV [ -n ]
X#	for a general update, or
X#		UV [ -n ] file ...
X#	for a partial update.
X#
X#	Modified or non-existent RCS files are checked out.
X#	Modified user files are reported as M <user_file>.  If both the
X#	RCS file and the user file have been modified, the user file
X#	is replaced by the result of rcsmerge.  If this throws up
X#	irreconcilable differences, the file is reported as C <user_file>,
X#	and as M <user_file> otherwise.
X#	Files added but not yet committed are reported as A <user_file>.
X#	Files removed but not yet decommitted are reported as R <user_file>.
X#
X#	If the present directory contains subdirectories that hold
X#	concurrent versions, these are updated too.  (See, however, CM.)
X#
X#	The -n option restricts the actions to reporting only.
X#
XName=UV; export Name
X
X# CVSBIN, CVSLIB and RCSBIN directories
XCVSBIN=/user1/dick/cvs
XCVSLIB=/user1/dick/cvs
XRCSBIN=${RCSBIN-/usr/new}
Xexport CVSBIN CVSLIB RCSBIN
X
X# avoid spurious identifications
XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
X
X# determine the name of the repository
X. $CVSLIB/NR.aux
X
X# to ACT or not to ACT, that is the question
Xcase "$1" in
X-n)
X	ACT=echo
X	shift
X	;;
X*)
X	ACT=
X	;;
Xesac
X
X#	A T T E M P T   R E A D   A C C E S S
X
XLDR=$Repository				# the directory
XLCK=$LDR/\#cvs.lock			# the lock
XTFL=$LDR/\#cvs.tfl.$$			# a temporary test file
XRFL=$LDR/\#cvs.rfl.$$			# the personal read flag
X
Xif	# we have write access to $LDR (can't test with [ -w $LDR ] )
X	cp /dev/null $TFL >/dev/null 2>/dev/null
Xthen	# we can do a fully protected read
X	rm $TFL
X	
X	# set lock
X	. $CVSLIB/SL.aux		# persistently tries to mkdir $LCK
X	
X	#	C R I T I C A L   S E C T I O N
X	
X	cp /dev/null $RFL		# plant the personal read flag
X	rmdir $LCK			# remove lock
X	# set trap to remove flag on interrupt and exit
X	trap 'rm -f $RFL; exit' 0 1 2 3 15
X	
X	#	E N D   O F   C R I T I C A L   S E C T I O N
X
Xelse	# just use your luck, and some heuristics
X	while	# the lock is there
X		[ -d $LCK ]
X	do
X		# we missed it this cycle
X		echo $Name: `date`: waiting for the lock to disappear
X		
X		sleep 60
X	done
Xfi
X
X# determine the way we are called
Xcase $# in
X0)
X	# no file names: all pertinent files
X	set "`$CVSLIB/FN.aux $Repository`"
X	$ACT cp /dev/null CVS.adm/Mod
X	NOPARAMS=yes			# for directory search
X	;;
Xesac
X
X# collect the sets of affected files
X
XOK=yes
X. $CVSLIB/CS.aux	# sets CLIST, GLIST, MLIST, OLIST, ALIST, RLIST, WLIST
X
Xcase $OK in
Xno)
X	echo $Name failed\; correct above errors first >&2
X	exit 1
Xesac
X
X# remove superfluous administration entries
Xfor User in $WLIST
Xdo
X	$ACT $CVSLIB/SC.aux $User
Xdone
X
X# do all the check-outs
X
Xfor User in $OLIST
Xdo
X	Rcs=$Repository/$User,v
X	
X	Tmp=,,$User
X	# put user file aside, but safety first
X	if	# $User exists
X		[ -r $User ]
X	then	# put it aside
X		$ACT mv $User $Tmp
X	else	# avoid confusion
X		$ACT rm -f $Tmp
X	fi
X	
X	if	# check out $Rcs into $User
X		$ACT $RCSBIN/co -q $Rcs $User
X	then	# adjust $User
X		$ACT chmod +w $User
X		# make a reference with the new time stamp
X		. $CVSLIB/VT.aux
X		$ACT $CVSLIB/RG.aux $User $VN_Rcs "$TS_User"
X	else
X		if	# there was a set-aside
X			[ -r $Tmp ]
X		then	# restore $User from it
X			$ACT mv $Tmp $User
X		fi
X		echo $Name: could not check out $User >&2
X		OK=no
X	fi
X	
X	# remove the set-aside
X	$ACT rm -f $Tmp
Xdone
X
X# report all modifications
Xfor User in $MLIST
Xdo
X	echo M $User
X	echo $User >>CVS.adm/Mod
Xdone
X
Xfor User in $ALIST
Xdo
X	echo A $User
Xdone
X
Xfor User in $RLIST
Xdo
X	echo R $User
Xdone
X
X# do all the merges
Xfor User in $GLIST
Xdo
X	Rcs=$Repository/$User,v
X	. $CVSLIB/VT.aux	# sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
X	
X	if	# merge differences between $Rcs version $VN_User and
X		# head version of $Rcs into $User
X		$ACT $RCSBIN/rcsmerge -r$VN_User $Rcs 2>&1
X	then	:
X	else	# something very wrong
X		echo $Name: could not merge revision $VN_User of $User >&2
X		OK=no
X		continue
X	fi
X	
X	# register again with *OLD* time stamp and *NEW* version number
X	$ACT $CVSLIB/RG.aux $User $VN_Rcs "$TS_Rcs"
X	
X	if	# find out about conflicts the only way I know
X		grep '^>>>>>>> ' $User >/dev/null
X	then
X		echo $Name: conflicts found in $User >&2
X		echo C $User		# $User Conflict
X	else
X		echo M $User		# $User Modified
X	fi
X	echo $User >>CVS.adm/Mod
Xdone
X
Xsort -u CVS.adm/Mod -o CVS.adm/Mod
X
X# descend into lower directories, if any
Xcase $NOPARAMS in
Xyes)
X	for D in *
X	do
X		if	# $D for directory
X			[ -d $D ] \
X		&&	# $D holds a concurrent version
X			[ -d $D/CVS.adm ]
X		then	# recursively apply UV
X			(cd $D; $CVSBIN/UV)
X		fi
X	done
X	;;
Xesac
X
X$CVSLIB/EF.aux				# update CVS.adm/Files
X
X# did we succeed?
Xcase $OK in
Xno)
X	exit 1
X	;;
Xesac
X
Xexit 0
+ END-OF-FILE UV
chmod 'u=rwx,g=rx,o=rx' \U\V
set `sum \U\V`
sum=$1
case $sum in
55802)	:;;
*)	echo 'Bad sum in '\U\V >&2
esac
exit 0



More information about the Mod.sources mailing list