rsalz@uunet.uu.net (Rich Salz) (05/04/90)
Submitted-by: Dick Grune <dick@cs.vu.nl> Posting-number: Volume 22, Issue 14 Archive-name: cvs3.0/part02 ---------------------------------------------------------------- : This is a shar archive. Extract with sh, not csh. : This archive ends with exit, so do not worry about trailing junk. : --------------------------- cut here -------------------------- PATH=/bin:/usr/bin:/usr/ucb echo Extracting 'Install' sed 's/^X//' > 'Install' << '+ END-OF-FILE ''Install' 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 3.1 89/09/25 16:32:00 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/bin `pwd` /usr/bin 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' 'Install' set `wc -c 'Install'` count=$1 case $count in 738) :;; *) echo 'Bad character count in ''Install' >&2 echo 'Count should be 738' >&2 esac echo Extracting 'AE' sed 's/^X//' > 'AE' << '+ END-OF-FILE ''AE' 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 3.2 89/10/02 15:14:23 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 configuration; 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=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" X. $CVSLIB/NR.aux X X# get possible options X. $CVSLIB/OP.aux # sets $Options X X# is the number of parameters correct? Xcase $# in X0) X echo Call is: $Name \<options\> filename ... \ X to add files to present configuration >&2 X exit 1 X ;; Xesac X XOK=yes Xfor User in $@ Xdo X case $User in X */*) X echo $Name: cannot add non-local files \($User\) >&2 X OK=no X continue X ;; X esac X 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' 'AE' set `wc -c 'AE'` count=$1 case $count in 3301) :;; *) echo 'Bad character count in ''AE' >&2 echo 'Count should be 3301' >&2 esac echo Extracting 'CM' sed 's/^X//' > 'CM' << '+ END-OF-FILE ''CM' 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 3.1 89/09/25 16:29:59 dick Exp $ X X# X# C o m m i t X# CM commits the present configuration 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# The -n option restricts the actions to reporting only. X# XName=CM; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" X. $CVSLIB/NR.aux X X# get possible options X. $CVSLIB/OP.aux # sets $Options X X# to ACT or not to ACT, that is the question Xcase "$Options" in X*-n*) X ACT=echo 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 XAutoRemove=yes # with AutoRemove on, X. $CVSLIB/WL.aux # set write lock to write in safety 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 NOPARAMS=yes X ;; X*) X NOPARAMS=no 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; unlock 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 Xfor User in $ALIST 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 Xfor User in $MLIST Xdo X . $CVSLIB/CI.aux # a careful check-in; may set OK=no Xdone X X# remove the RCS files in the RLIST Xcase "$RLIST" in X"") X # no need for $Repository/Attic X ;; X*) X # $Repository/Attic needed X Attic=$Repository/Attic X X if [ -d $Attic ] X then # $Attic exists X : X else # $Attic must be made X if $ACT mkdir $Attic >/dev/null 2>/dev/null X then : X else echo $Name: could not make $Attic X OK=no X fi X fi X X if [ -d $Attic ] X then X for User in $RLIST X do X Rcs=$Repository/$User,v X Old=$Attic/$User,v X X if # we can move the 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 \ X to $Old failed >&2 X OK=no X fi X done X fi Xesac X Xcase $NOPARAMS in Xyes) # clear the Mod list, for full commit only X $ACT cp /dev/null CVS.adm/Mod X #set time of last update, since commit involves an update X $ACT rm -f CVS.adm/LastUpdate X $ACT cp /dev/null CVS.adm/LastUpdate X ;; Xesac X X# did we succeed? Xcase $OK in Xno) X exit 1 X ;; Xesac X X# All has gone well: register the commit X XAdmin=$Repository/Admin XCfr=CVS.confrec XRcsCfr=$Admin/$Cfr,v XUsrCfr=CVS.adm/$Cfr X X# we need the Admin directory Xif # $Admin exists X [ -d $Admin ] Xthen : Xelse # $Admin must be made X if $ACT mkdir $Admin >/dev/null 2>/dev/null X then : X else echo $Name: could not make $Admin >&2 X exit 1 X fi Xfi X X# create the new configuration history file X<CVS.adm/Entries sed 's/|.* /| /' >$UsrCfr X X# and commit it XRevision= X. $CVSLIB/CC.aux # commit configuration record X Xexit 0 X + END-OF-FILE CM chmod 'u=rwx,g=rx,o=rx' 'CM' set `wc -c 'CM'` count=$1 case $count in 4949) :;; *) echo 'Bad character count in ''CM' >&2 echo 'Count should be 4949' >&2 esac echo Extracting 'CV' sed 's/^X//' > 'CV' << '+ END-OF-FILE ''CV' 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 3.1 89/09/25 16:30: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 the configuration described by an RCS X# repository. This configuration is owned totally by the user and is X# actually an independent copy, to be dealt with as seen fit. Once CV X# has been called in a given directory, it never needs to be called X# again. The user can keep up-to-date by calling UV when he feels like X# it; this will supply him with a merge of his own modifications and X# 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 configuration can be committed by CM; this keeps the present X# configuration 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 CVS keeps its X# administration, in a number of files. Only the file X# ./CVS.adm/Repository is of importance to the user, since it contains X# the name of the repository. This file is a normal file and can be X# edited by the user, if necessary (when the repository is moved, e.g.) X# XName=CV; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# is the number of parameters correct? Xcase $# in X1) # OK X ;; X*) X echo Call is: $Name repository-name >&2 X exit 1 X ;; Xesac X XRepository=$1 X X# check the existence of the repository X. $CVSLIB/NR.aux X X# create the user administration directory X. $CVSLIB/CA.aux # uses $Repository 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' 'CV' set `wc -c 'CV'` count=$1 case $count in 2247) :;; *) echo 'Bad character count in ''CV' >&2 echo 'Count should be 2247' >&2 esac echo Extracting 'DF' sed 's/^X//' > 'DF' << '+ END-OF-FILE ''DF' 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 3.1 89/09/25 16:31:00 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, DF treats the files that have been X# modified since the last call to CM. If the option is -n, diff(1) will X# not be called, but the list of modified files will be displayed X# instead. X# XName=DF; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" 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 list names of modified files X $CVSLIB/MF.aux X exit 0 X ;; Xesac X X# determine the way we are called Xcase $# in X0) X # no file names: get list of modified files X MODFILES=`$CVSLIB/MF.aux` X if # there are none X [ "$MODFILES" = "" ] X then X echo $Name: no modifications to report X exit 0 X fi X set $MODFILES 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' 'DF' set `wc -c 'DF'` count=$1 case $count in 2887) :;; *) echo 'Bad character count in ''DF' >&2 echo 'Count should be 2887' >&2 esac echo Extracting 'GC' sed 's/^X//' > 'GC' << '+ END-OF-FILE ''GC' 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 3.1 89/09/25 16:31:29 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; does consistency checks. X# Should be called after crashes while a CVS-program was running, X# and other mishaps. X# XName=GC; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" 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 /^LastUpdate$/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 if # there are RCS files there X [ "`echo *,v`" != "*,v" ] X then # check them X $RCSBIN/rlog -Lh *,v X fi X if # there are hidden RCS files there X [ "`echo .*,v`" != ".*,v" ] X then # check them too X $RCSBIN/rlog -Lh .*,v X fi X) X X# try to find garbage left-over by RCS X( X ls -d ,* $Repository/,* 2>&1 X) | 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 X# If there is a $Header in the user file, see if it has the same X# version number as in the administration Xfor User in `$CVSLIB/FN.aux $Repository` Xdo X . $CVSLIB/VT.aux # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs X . $CVSLIB/HN.aux # sets $HN_User X X if # there was a $Header X [ "$HN_User" != "" ] \ X && # it is not equal to the one in Entries X [ "$HN_User" != "$VN_User" ] X then X echo $Name: $User has version number $VN_User \ X in administration and $HN_User in Header X fi Xdone X Xrm -f $Tmp1 $Tmp2 + END-OF-FILE GC chmod 'u=rwx,g=rx,o=rx' 'GC' set `wc -c 'GC'` count=$1 case $count in 2569) :;; *) echo 'Bad character count in ''GC' >&2 echo 'Count should be 2569' >&2 esac echo Extracting 'HR' sed 's/^X//' > 'HR' << '+ END-OF-FILE ''HR' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: HR,v 3.1 89/09/25 16:31:50 dick Exp $ X X# X# H i g h e s t R e l e a s e N u m b e r X# Writes the highest release number of the repository to standard output. X# Applies to a repository or to the working directory. X# XName=HR; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository=$1 # if present X. $CVSLIB/NR.aux X X# set up names in Admin XAdmin=$Repository/Admin XHighest=$Admin/HighestRelease X X# we need the Admin directory Xif # $Admin exists X [ -d $Admin ] Xthen : Xelse # $Admin must be made X if $ACT mkdir $Admin >/dev/null 2>/dev/null X then : X else echo $Name: could not make $Admin >&2 X exit 1 X fi Xfi X X# we need the highest release number file Xif # there is a highest release number file X [ -r $Highest ] Xthen : Xelse # create it X RCSFILES=` X ls $Repository/*,v $Repository/Attic/*,v 2>/dev/null | X grep -v "\*" X ` X ( X echo 0 # in case the directory is empty X for Rcs in $RCSFILES X do X $CVSLIB/VN.aux $Rcs X done X ) | X sed 's/\..*//' | X sort -nru | X sed '1q' >$Highest Xfi X Xcat $Highest X + END-OF-FILE HR chmod 'u=rwx,g=rx,o=rx' 'HR' set `wc -c 'HR'` count=$1 case $count in 1378) :;; *) echo 'Bad character count in ''HR' >&2 echo 'Count should be 1378' >&2 esac echo Extracting 'LS' sed 's/^X//' > 'LS' << '+ END-OF-FILE ''LS' 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 3.1 89/09/25 16:32:40 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# X# If the option -l is given, each report will be followed by X# the log of the the file as kept by RCS. X# XName=LS; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" X. $CVSLIB/NR.aux X X# get possible options X. $CVSLIB/OP.aux # sets $Options X X# check option Xcase "$Options" in X""|" -l") X # OK X ;; X*) X echo Call is: $Name \[ -l \] filename ... >&2 X exit 1 X ;; Xesac 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 ;; 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 . $CVSLIB/HN.aux # sets $HN_User X X case "$TS_User" in X "") X echo "User: no user file $User" X ;; X *) X echo "User: $HN_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 X if # RCS log requested X [ "$Options" = " -l" ] X then X $RCSBIN/rlog $Rcs X fi X echo '' Xdone + END-OF-FILE LS chmod 'u=rwx,g=rx,o=rx' 'LS' set `wc -c 'LS'` count=$1 case $count in 1807) :;; *) echo 'Bad character count in ''LS' >&2 echo 'Count should be 1807' >&2 esac echo Extracting 'NR' sed 's/^X//' > 'NR' << '+ END-OF-FILE ''NR' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: NR,v 3.1 89/09/25 16:33:18 dick Exp $ X X# X# N e w R e l e a s e X# NR <number> <repository-name> will raise the version number of all X# files in the repository to <number>.1 The <number> must be higher X# than the highest release number in the repository. X# XName=NR; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# check parameters Xcase $# in X2) # OK X ;; X*) X echo Call is: $Name release-number repository >&2 X exit 1 X ;; Xesac X X# check the existence of the repository XRepository="$2" X. $CVSLIB/NR.aux X X# is the repository properly locked? XLCK=$Repository/\#cvs.lock # the lock XLFL=$Repository/\#cvs.lfl # the general lock flag X Xif # there is a lock and it comes from LCK X [ -d $LCK -a -f $LFL ] Xthen : Xelse X echo $Name: repository $Repository was not locked by LCK on >&2 X exit 1 Xfi X XNewNumber=$1 Xcase "$1" in X[0-9]*) # OK X ;; X*) X echo $Name on $Repository: release-number $NewNumber \ X is not numerical >&2 X ;; Xesac X X# set up names in Admin XAdmin=$Repository/Admin XCfr=CVS.confrec XRcsCfr=$Admin/$Cfr,v XUsrCfr=$Admin/$Cfr XHighest=$Admin/HighestRelease X X# get the old release number (also insures the presence of $Repository/Admin) XOldNumber=`$CVSBIN/HR $Repository` X Xif [ $NewNumber -le $OldNumber ] Xthen # release number can only go up X echo $Name on $Repository: new release number $NewNumber \ X not larger than old release number $OldNumber >&2 X exit 1 Xfi X XMessage="Release number raised to $NewNumber" X X# make an empty scratch directory to check out the files XNRDir=$Admin/NRDir Xrm -rf $NRDir # remove left-overs Xif # we can make such a directory X mkdir $NRDir Xthen : Xelse X echo $Name: could not make scratch directory $NRDir >&2 X exit 1 Xfi X X# set trap to remove scratch directory on interrupt and exit Xtrap 'rm -rf $NRDir; exit 1' 1 2 3 15 Xtrap 'rm -rf $NRDir; exit 0' 0 X X# clear the configuration record Xcp /dev/null $UsrCfr X X# get all files in the repository X(cd $Repository; ls *,v .*,v 2>/dev/null | grep -v '\*') | Xwhile read File Xdo X Rcs=$Repository/$File X Working=$NRDir/`basename $File ,v` X X if # check out the RCS file into the scratch directory X $RCSBIN/co -l -q $Rcs $Working 2>&1 X then : X else X echo $Name: could not check out $Working >&2 X exit 1 X fi X X if # check in the user file with new release number X $RCSBIN/ci -r$NewNumber.1 -m"$Message" -f $Rcs $Working 2>&1 X then : X else # something is very wrong X echo $Name: could not check in $Working >&2 X rm $Working X if # unlock $Rcs X $RCSBIN/rcs -u $Rcs X then : X else X echo $Name: could not UNlock $Rcs >&2 X fi X exit 1 X fi X X # add to configuration record X echo "$NewNumber| $File|" >>$UsrCfr Xdone X X# check in the configuration record, to establish the new situation X XACT= # no -n option to NR XRevision=-r$NewNumber.1 X. $CVSLIB/CC.aux # commit configuration record X X# update $Highest Xecho $NewNumber >$Highest X Xexit 0 X + END-OF-FILE NR chmod 'u=rwx,g=rx,o=rx' 'NR' set `wc -c 'NR'` count=$1 case $count in 3147) :;; *) echo 'Bad character count in ''NR' >&2 echo 'Count should be 3147' >&2 esac echo Extracting 'RC' sed 's/^X//' > 'RC' << '+ END-OF-FILE ''RC' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Erik Baalbergen, Vrije Universiteit, Amsterdam. X# $Header: RC,v 3.3 89/10/13 12:04:30 dick Exp $ X X# X# R e a d C o n f i g u r a t i o n h i s t o r y X# X# Reads the configuration history file, either of the working X# directory or of a repository. X# RC -i X# will display the present configuration identifier. X# XName=RC; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# get the one possible option Xcase "$1" in X-i) X Option=$1 X shift X ;; X-*) X echo Call is: $Name \[ -i \] \[ repository-name \] >&2 X exit 1 X ;; Xesac X X# determine the name of the repository XRepository=$1 X. $CVSLIB/NR.aux X X# set up names in Admin XAdmin=$Repository/Admin XCfr=CVS.confrec XRcsCfr=$Admin/$Cfr,v X Xif [ -f $RcsCfr ] Xthen X case "$Option" in X '') # display the whole configuration history X # get the RCS log X if $RCSBIN/rlog $RcsCfr X then : X else X echo $Name: rlog failed on existing $RcsCfr >&2 X exit 1 X fi | X # remove all kinds of garbage X tr '\200-\377' '' | X # identify revision and date lines X sed ' X /^-*$/{ X N X s/\nrevision /\ X<REV> / X N X s/\ndate: /\ X<DATE> / X } X ' | X # edit date lines and remove crud X sed ' X 1,/^-*$/d X /^<DATE>/s/; author: / / X /^<DATE>/s/; .*// X /^-*$/d X /^=*$/d X ' | X # format output X awk '{ X if ($1 == "<REV>") { X rev = $2; X } X else X if ($1 == "<DATE>") { X date = $2; time = $3; author = "(" $4 ")"; X } X else { X printf("%s\t%s %s %s\t%s\n", \ X rev, date, time, author, $0); X rev = ""; date = " "; time = " "; X author = "\t"; X } X }' X ;; X X -i) # display present configuration identifier X if $RCSBIN/rlog $RcsCfr X then : X else X echo $Name: rlog failed on existing $RcsCfr >&2 X exit 1 X fi | X grep '^revision ' | X sed ' X s/revision // X s/ *$// X 2,$d X ' X ;; X esac Xelse X echo $Name: no configuration history available for $Repository >&2 X exit 1 Xfi X Xexit 0 + END-OF-FILE RC chmod 'u=rwx,g=rx,o=rx' 'RC' set `wc -c 'RC'` count=$1 case $count in 2149) :;; *) echo 'Bad character count in ''RC' >&2 echo 'Count should be 2149' >&2 esac echo Extracting 'RM' sed 's/^X//' > 'RM' << '+ END-OF-FILE ''RM' 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 3.1 89/09/25 16:34:26 dick Exp $ X X# X# R e m o v e E n t r y X# RM filename ... : removes entries from the present configuration. 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=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" X. $CVSLIB/NR.aux X X# is the number of parameters correct? Xcase $# in X0) X echo Call is: $Name filename ... \ X to remove files from present configuration >&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' 'RM' set `wc -c 'RM'` count=$1 case $count in 1515) :;; *) echo 'Bad character count in ''RM' >&2 echo 'Count should be 1515' >&2 esac echo Extracting 'RV' sed 's/^X//' > 'RV' << '+ END-OF-FILE ''RV' 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 3.1 89/09/25 16:34:36 dick Exp $ X X# X# R e s t o r e V e r s i o n X# RV restores a version of the configuration, given the repository name X# and a configuration identifier. The call is X# RV <repository-name> <configuration-identifier> X# The files will be reconstructed with the correct revision number, X# even if they have been removed by RM and CM in the meantime. X# X# For backward compatibility, RV will still be able to work from X# SV-records, as created by the late program SV. The SV-record will be X# read from standard input by the call X# RV <repository-name> - XName=RV; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# is the number of parameters correct? Xcase $# in X2) # OK X ;; X*) X echo Call is: $Name repository-name configuration-identifier >&2 X exit 1 X ;; Xesac X XRepository=$1 XConfIdf=$2 # configuration identifier;could be a - X X# check the existence of the repository X. $CVSLIB/NR.aux X X# set up names in Admin XAdmin=$Repository/Admin XCfr=CVS.confrec XRcsCfr=$Admin/$Cfr,v X Xcase $ConfIdf in X-) # obsolete case of a SV record X # create the administration directory X . $CVSLIB/CA.aux # uses $Repository X X # get the CVS.adm/Entries file from standard input X cat - >CVS.adm/Entries X ;; X X*) # $ConfIdf is a real configuration identifier X if [ -f $RcsCfr ] X then X # create the administration directory X . $CVSLIB/CA.aux # uses $Repository X X # get the configuration record of the denoted configuration X if $RCSBIN/co -p -q -r$ConfIdf $RcsCfr >CVS.adm/Entries X then : X else X echo $Name: there is no configuration $ConfIdf >&2 X exit 1 X fi X else X echo $Name: no configuration history available \ X for $Repository >&2 X exit 1 X fi Xesac 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 on $Repository: $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 on $Repository: could not check out \ X $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' 'RV' set `wc -c 'RV'` count=$1 case $count in 3183) :;; *) echo 'Bad character count in ''RV' >&2 echo 'Count should be 3183' >&2 esac echo Extracting 'UV' sed 's/^X//' > 'UV' << '+ END-OF-FILE ''UV' 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 3.1 89/09/25 16:35:08 dick Exp $ X X# X# U p d a t e V e r s i o n X# UV updates the configuration in the present directory with respect to X# the RCS repository. The present configuration must have been created X# by CV. The user can keep up-to-date by calling UV whenever he feels X# like it. The present configuration can be committed by CM, but this X# keeps the configuration 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# The -n option restricts the actions to reporting only. X# XName=UV; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" X. $CVSLIB/NR.aux X X# get possible options X. $CVSLIB/OP.aux # sets $Options X X# to ACT or not to ACT, that is the question Xcase "$Options" in X"") X ACT= X ;; X" -n") X ACT=echo X ;; X*) X echo Call is: $Name \[ -n \] \[ filename ... \] >&2 X exit 1 X ;; Xesac X X# A T T E M P T R E A D A C C E S S X XLCK=$Repository/\#cvs.lock # the lock XTFL=$Repository/\#cvs.tfl.$$ # a temporary test file XRFL=$Repository/\#cvs.rfl.$$ # the personal read flag X Xif # we have write access to $Repository X # (can't test with [ -w $Repository ] ) 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 traps to remove flag on interrupt and exit X trap 'rm -f $RFL; exit 1' 1 2 3 15 X trap 'rm -f $RFL; exit 0' 0 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 \ X in $Repository to disappear 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 X ;; X*) X NOPARAMS=no 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 Orig=,,$User X # put user file aside, if it exists, to preserve the inode X if # $User exists X [ -r $User ] X then # put it aside X $ACT mv $User $Orig X else # avoid confusion X $ACT rm -f $Orig X fi X X if # check out $Rcs into $User, creating a new inode X $ACT $RCSBIN/co -q $Rcs X then # we now have a new copy of $User X if # there was an original inode X [ -r $Orig ] X then # bring it back after filling it with the new copy X $ACT cp $User $Orig X $ACT rm -f $User X $ACT mv $Orig $User X else # make do with the copy just checked in X $ACT chmod +w $User X fi 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 # something is wrong X if # there was an original X [ -r $Orig ] X then # restore $User from it X $ACT mv $Orig $User X fi X echo $Name: could not check out $User >&2 X OK=no X fi 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 X$ACT sort -u CVS.adm/Mod -o CVS.adm/Mod X Xcase $NOPARAMS in Xyes) # set last update time stamp, for full update only X $ACT rm -f CVS.adm/LastUpdate X $ACT cp /dev/null CVS.adm/LastUpdate X ;; Xesac X X$ACT $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' 'UV' set `wc -c 'UV'` count=$1 case $count in 5333) :;; *) echo 'Bad character count in ''UV' >&2 echo 'Count should be 5333' >&2 esac echo Extracting 'REP' sed 's/^X//' > 'REP' << '+ END-OF-FILE ''REP' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: REP,v 3.3 89/10/06 12:58:01 dick Exp $ X X# X# R E P e a t a C V S c o m m a n d X# XName=REP; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# get the one possible option Xcase "$1" in X-n) X ACT=echo X shift X ;; Xesac X XCOMMAND=$1 Xcase "$COMMAND" in X""|-*) X echo Call is: $Name command \[ -n \] \[ parameters \] >&2 X exit 1 X ;; Xesac Xshift X Xcase "$COMMAND" in X XAE|RM)# unapplicable commands X echo $Name: command $COMMAND is not repeatable X exit 1 X ;; X XDF|GC|LS|UV)# cat UserDir-list | REP $COMMAND X while read UserDir X do X if [ "$UserDir" = "" ] X then continue X fi X ( echo Changing to directory $UserDir X $ACT cd $UserDir X $ACT $CVSBIN/$COMMAND X ) X done X ;; X XCM) # cat UserDir-list | REP $COMMAND 'message' X Message="$1" X case "$Message" in X "") X echo $Name: command $COMMAND requires a message parameter >&2 X exit 1 X ;; X esac X while read UserDir X do X if [ "$UserDir" = "" ] X then continue X fi X ( echo Changing to directory $UserDir X $ACT cd $UserDir X $ACT $CVSBIN/$COMMAND "$Message" X ) X done X ;; X XRC) # cat Repository-list | REP $COMMAND [ -i ] X if # special output requested X [ X"$1" = X-i ] X then # edit the output X while read Repository X do X if [ "$Repository" = "" ] X then continue X fi X $ACT $CVSBIN/$COMMAND -i $Repository | X sed 's|^|'"$Repository"' |' X done X else # format the output X while read Repository X do X if [ "$Repository" = "" ] X then continue X fi X echo Configuration history of $Repository X $ACT $CVSBIN/$COMMAND $Repository X echo '' X done X fi X ;; X XHR) # cat Repository-list | REP $COMMAND X while read Repository X do X if [ "$Repository" = "" ] X then continue X fi X $ACT $CVSBIN/$COMMAND $Repository X done | X sort -nru | X sed '1q' X ;; X XLCK) # cat Repository-list | REP $COMMAND [ on | off ] X Request="$1" X case "$Request" in X on|off) # OK X ;; X *) X echo $Name: command $COMMAND requires \ X a request parameter \[ on \| off \] >&2 X exit 1 X ;; X esac X while read Repository X do X if [ "$Repository" = "" ] X then continue X fi X $ACT $CVSBIN/$COMMAND $Request $Repository X done X ;; X XNR) # cat Repository-list | REP $COMMAND release-number X RelNumber="$1" X case "$RelNumber" in X [0-9]*) # OK X ;; X *) X echo $Name: command $COMMAND requires \ X a release-number parameter >&2 X exit 1 X ;; X esac X while read Repository X do X if [ "$Repository" = "" ] X then continue X fi X $ACT $CVSBIN/$COMMAND $RelNumber $Repository X done X ;; X XCV|RV) # cat Repository-UserDir-list | REP $COMMAND X # cat Repository-UserDir-ConfIdf-list | REP $COMMAND X while read Repository UserDir ConfIdf X do X if [ "$Repository" = "" ] X then continue X fi X if [ "$UserDir" = "" ] X then echo $Name: no user directory for command \ X $COMMAND $Repository >&2 X exit 1 X fi X if [ $COMMAND = "RV" -a "$ConfIdf" = "" ] X then echo $Name: no configuration identifier for command \ X $COMMAND $Repository >&2 X exit 1 X fi X if # $UsedDir does not exist X [ ! -d $UserDir ] X then # try to create it X if $ACT mkdir $UserDir X then : X else echo $Name: cannot make $UserDir >&2 X exit 1 X fi X fi X X ( echo Changing to directory $UserDir X $ACT cd $UserDir X $ACT $CVSBIN/$COMMAND $Repository $ConfIdf X ) X done X ;; X X*) X echo $Name: $COMMAND is an unknown command >&2 X exit 1 X ;; Xesac X Xexit 0 X + END-OF-FILE REP chmod 'u=rwx,g=rx,o=rx' 'REP' set `wc -c 'REP'` count=$1 case $count in 3579) :;; *) echo 'Bad character count in ''REP' >&2 echo 'Count should be 3579' >&2 esac echo Extracting 'LAR' sed 's/^X//' > 'LAR' << '+ END-OF-FILE ''LAR' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: LAR,v 3.1 89/09/25 16:32:08 dick Exp $ X X# X# L i s t A l l R e p o s i t o r i e s X# LAR <directory> lists all repositories that are subdirectories of X# <directory>, according to the criterion that a repository contains RCS X# files and that it is not named Attic or Admin. X# XName=LAR; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X XDIR=$1 Xcase "$DIR" in X"") X echo Call is: $Name directory >&2 X exit 1 X ;; Xesac Xshift X Xfind $DIR -type d -a -print | Xwhile read Repository Xdo X BASENAME=`basename $Repository` X if # this is definitely not a repository X [ "$BASENAME" = Admin -o "$BASENAME" = Attic ] X then # skip it X : X elif # this is definitely a repository X [ -d $Repository/Admin -o -d $Repository/Attic \ X -o "`echo $Repository/*,v`" != "$Repository/*,v" \ X -o "`echo $Repository/.*,v`" != "$Repository/.*,v" \ X ] X then # report it X echo $Repository X else # we suppose it isn't X : X fi Xdone X Xexit 0 + END-OF-FILE LAR chmod 'u=rwx,g=rx,o=rx' 'LAR' set `wc -c 'LAR'` count=$1 case $count in 1241) :;; *) echo 'Bad character count in ''LAR' >&2 echo 'Count should be 1241' >&2 esac echo Extracting 'LAU' sed 's/^X//' > 'LAU' << '+ END-OF-FILE ''LAU' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: LAU,v 3.1 89/09/25 16:32:18 dick Exp $ X X# X# L i s t A l l U s e r d i r e c t o r i e s X# LAU lists all user directories under CVS that are subdirectories of X# the working directory, according to the criterion that a user X# directory under CVS contains a directory CVS.adm. X# XName=LAU; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X Xcase "$1" in X"") # OK X ;; X*) # error X echo Call is: $Name \(works on working directory\) >&2 X exit 1 X ;; Xesac X Xfind . -type d -a -print | Xwhile read UserDir Xdo X if # this is a directory under CVS X [ -d $UserDir/CVS.adm ] X then # report it X echo $UserDir X fi Xdone X Xexit 0 + END-OF-FILE LAU chmod 'u=rwx,g=rx,o=rx' 'LAU' set `wc -c 'LAU'` count=$1 case $count in 945) :;; *) echo 'Bad character count in ''LAU' >&2 echo 'Count should be 945' >&2 esac echo Extracting 'LCK' sed 's/^X//' > 'LCK' << '+ END-OF-FILE ''LCK' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: LCK,v 3.1 89/09/25 16:32:25 dick Exp $ X X# X# L o C K X# LCK on <repository> sets a lock in <repository> X# LCK off <repository> removes the lock. X# For maintenance only. NOT to be used by the normal user; CM and UV X# handle all normal cases. X# XName=LCK; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# get the request XRequest=$1 Xcase "$Request" in Xon|off) # OK X ;; X*) X echo Call is: $Name \[ on \| off \] repository-name >&2 X exit 1 Xesac Xshift X X# is the number of parameters correct? Xcase $# in X1) # OK X ;; X*) X echo Call is: $Name \[ on \| off \] repository-name >&2 X exit 1 X ;; Xesac X XRepository=$1 X X# check the existence of the repository X. $CVSLIB/NR.aux X XLCK=$Repository/\#cvs.lock # the lock XTFL=$Repository/\#cvs.tfl # pattern of temporary test files XRFL=$Repository/\#cvs.rfl # pattern of the read flags XWFL=$Repository/\#cvs.wfl # the general write flag XLFL=$Repository/\#cvs.lfl # the general lock flag X Xcase $Request in Xon) # now just lock the repository X AutoRemove=no # with AutoRemove off, X . $CVSLIB/WL.aux # set write lock X cp /dev/null $LFL # and plant the lock flag X ;; X Xoff) # let's have a look X if # there is a lock X [ -d $LCK ] X then # we must first remove the non-lock flags X rm -f $TFL.* $RFL.* $WFL X # and then the lock (otherwise somebody can plant a flag X # just after the rmdir and just before the rm $WFL ! X if rmdir $LCK X then : X else X echo $Name: could not remove existing lock \ X in $Repository >&2 X exit 1 X fi X rm -f $LFL X else X echo $Name: there is no lock in $Repository >&2 X exit 1 X fi X ;; Xesac X Xexit 0 X + END-OF-FILE LCK chmod 'u=rwx,g=rx,o=rx' 'LCK' set `wc -c 'LCK'` count=$1 case $count in 1899) :;; *) echo 'Bad character count in ''LCK' >&2 echo 'Count should be 1899' >&2 esac echo Extracting 'hist2' sed 's/^X//' > 'hist2' << '+ END-OF-FILE ''hist2' X#!/bin/sh X# This file is part of the Concurrent Versions System CVS. X# Written by Dick Grune, Vrije Universiteit, Amsterdam. X# $Header: hist2,v 3.2 89/10/13 11:54:54 dick Exp $ X X# X# Historian: ad-hoc configuration history reconstruction program, part 2 X# X# hist2 [ repository ] X# reads the output of hist1 from standard input and writes on standard X# output a shell script that will reconstruct the configuration history X# file of the repository. If no repository is given, the repository of X# the present directory is used. X# XName=hist2; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository=$1 X. $CVSLIB/NR.aux X X# write the header Xecho '#!/bin/sh' Xecho '' Xecho '#' Xecho '# This file was created by the CVS historian to reconstruct' Xecho '# the configuration history file of repository' Xecho '# '$Repository Xecho '#' Xecho 'Name=confrec.reconstructor; export Name' Xecho '' Xecho 'set -e' Xecho '' Xecho '# CVSBIN, CVSLIB and RCSBIN directories' Xecho 'CVSBIN='$CVSBIN Xecho 'CVSLIB='$CVSLIB Xecho 'RCSBIN='$RCSBIN Xecho 'export CVSBIN CVSLIB RCSBIN' Xecho '' Xecho '# avoid spurious identifications' Xecho 'PATH=${CVSPATH-/bin:/usr/bin}; export PATH' Xecho '' Xecho '# determine the name of the repository' Xecho 'Repository='$Repository Xecho '' Xecho 'Admin=$Repository/Admin' Xecho 'Cfr=CVS.confrec' Xecho 'RcsCfr=$Admin/$Cfr,v' Xecho 'UsrCfr=$Admin/$Cfr' Xecho '' Xecho 'if # there is a configuration history file' Xecho ' [ -r $RcsCfr ]' Xecho 'then # we are not going to overwrite it' Xecho ' echo $Name: there is a configuration history file already, $RcsCfr >&2' Xecho ' exit 1' Xecho 'fi' Xecho '' Xecho '# we need the Admin directory' Xecho 'if # $Admin exists' Xecho ' [ -d $Admin ]' Xecho 'then :' Xecho 'else # $Admin must be made' Xecho ' if mkdir $Admin >/dev/null 2>/dev/null' Xecho ' then :' Xecho ' else echo $Name: could not make $Admin >&2' Xecho ' exit 1' Xecho ' fi' Xecho 'fi' Xecho '' Xecho 'ACT=' Xecho 'Revision=' Xecho '' X X# create a shell script with the appropriate calls to $RCSBIN/ci X X# construct the successive configuration records Xawk ' X BEGIN { # awk has problems with empty arrays X rev[""] = "-"; # so we "declare" it X } X NF == 0 { # empty line, end of one CM X print "# New configuration record"; X print "cp /dev/null $UsrCfr"; X for (f in rev) { X if (rev[f] != "-") { X print "echo '\''" rev[f] "| " f "|'\'' >>$UsrCfr"; X } X } X print "CI " msg; # provisional form of call to ci X print "DT " date "@" author;# provisional form of dating X } X NF == 1 { # single file name, to be removed X rev[$1] = "-"; X } X NF > 1 { # normal modification X date = $1 "." $2; X rev[$3] = $4; X author = $5; X msg = $0; # to preserve the message X } X' | X X# double all backslashes; the shell "read" seems to strip them off again Xsed 's/\\/&&/g' | X X# expand the CI and DT lines Xwhile read LINE Xdo X case "$LINE" in X CI*) # the ci lines X echo '# check it in' X echo "$LINE" | X sed ' X # mark first semicolon X s/;.*/;;;&/ X # discard anything in front of it and itself X s/.*;;;; // X # quote funny characters X s/\\/\\&/g X s/"/\\&/g X s/`/\\&/g X s/\$/\\&/g X # edit into $Message for $CVSLIB/CC.aux X s/.*/Message="&"/ X s/\\\\n/\ X/g X ' X echo '. $CVSLIB/CC.aux # commit confrec file' X echo '' X ;; X X DT*) # the dating lines X echo '# fake the creation date and author of this entry' X echo '# the RCS file is unwritable; correct' X echo 'chmod +w $RcsCfr' X echo '# edit the $RcsCfr by brute force' X echo 'ed - $RcsCfr <<\!' X echo '/^date /s/^date .................;//' X echo 's/^ *author[^;]*;//' X echo "$LINE" | X sed ' X s/\//./g X s/:/./g X s/DT // X s/@/; author / X s/.*/s\/^\/date &;\// X ' X echo 'w' X echo 'q' X echo '!' X echo '# make the RCS unwritable again' X echo 'chmod -w $RcsCfr' X echo '' X ;; X X *) # normal lines X echo "$LINE" X ;; X esac Xdone X Xecho 'exit 0' X Xexit 0 X + END-OF-FILE hist2 chmod 'u=rwx,g=rx,o=rx' 'hist2' set `wc -c 'hist2'` count=$1 case $count in 4077) :;; *) echo 'Bad character count in ''hist2' >&2 echo 'Count should be 4077' >&2 esac echo Extracting 'coALL' sed 's/^X//' > 'coALL' << '+ END-OF-FILE ''coALL' X#!/bin/sh X X# X# Historian's aid: check out ALL versions of a file ($1) X# X# coALL creates a directory $1.ALL in which it checks out ALL X# versions of the file $1. Done to the Makefile, this can help in X# determining when exactly a file was RM-ed, to faithfully reconstruct X# the configuration history of the repository. X# XName=coALL; export Name X X# CVSBIN, CVSLIB and RCSBIN directories XCVSBIN=/home/top/dick/cvs XCVSLIB=/home/top/dick/cvs XRCSBIN=${RCSBIN-/usr/local/bin} Xexport CVSBIN CVSLIB RCSBIN X X# avoid spurious identifications XPATH=${CVSPATH-/bin:/usr/bin}; export PATH X X# determine the name of the repository XRepository="" X. $CVSLIB/NR.aux X XUser=$1 X Xset -e Xmkdir $User.ALL Xcd $User.ALL X X$RCSBIN/rlog $Repository/$User,v | Xgrep '^revision' | Xsed 's/revision //' | Xwhile read VN_User Xdo X $RCSBIN/co -q -r$VN_User $Repository/$User,v X mv $User $VN_User X chmod +w $VN_User Xdone X + END-OF-FILE coALL chmod 'u=rwx,g=rx,o=rx' 'coALL' set `wc -c 'coALL'` count=$1 case $count in 880) :;; *) echo 'Bad character count in ''coALL' >&2 echo 'Count should be 880' >&2 esac exit 0 exit 0 exit 0 # Just in case... -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.