head     1.4;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @# @;


1.4
date     90.04.02.15.52.30;  author kevin;  state Exp;
branches ;
next     1.3;

1.3
date     90.04.02.14.51.20;  author kevin;  state Exp;
branches ;
next     1.2;

1.2
date     90.03.24.22.05.37;  author kevin;  state Exp;
branches ;
next     1.1;

1.1
date     89.11.28.13.56.05;  author rsbx;  state Exp;
branches ;
next     ;


desc
@@


1.4
log
@Altered ckrcs in order to allow the non-existence of sfd files
for various modules.
@
text
@#! /bin/csh -f
#
#	ckrcs <version> <destination> <files>
#
#	look for the following conditions
#	1.  files on the server not mentioned in the Makefile (not fatal)
#	2.  files that are locked under rcs on the server (not fatal)
#	3.  files to be released that are different than rcs (fatal)
#	4.  files to be released that are not under rcs on the server (fatal)
#
if ($#argv < 2) then
    echo "Usage: $0 <version> <destination> <files>"
    exit 1
endif

set nonomatch

set locked=()
set extras=()
set movedrcs=()
set norcsfiles=()
set rcsmods=()
set nonfiles=()

set localdir=$cwd

# make a list of all the files that really exist here
rm -f /tmp/ckrcsFiles$$
foreach file ($argv[3-])
    if (-e $file) then
	echo $file >>/tmp/ckrcsFiles$$
    endif
end

# find if there is a corresponding RCS for all the files mentioned in makefile
foreach file ($argv[3-])
    cd $2
    if (-e RCS/$file,v) then
	cd $localdir
	set locked=($locked `rlog -L -R $file`)
	set head=`rlog -h $file | awk '$1 == "head:" {print int($2) "."; exit}' - `
	if (! -e $file) then
	    echo "checking out file $file"
	    co -q$head $file
	endif
	co -p -q$head $file | cmp -s - $file
	if ($status) then
	    set rcsmods=($rcsmods $file)
	endif
    else
	if (-e $localdir/$file) then
	    set norcsfiles=($norcsfiles $file)
	else
	   if (`echo $file | sed "s/.*\.//"` != sfd) set nonfiles=($nonfiles $file)
	endif	
    endif
end

cd $2

# look in the destination directory for extraneous files
set sfiles=(`/bin/ls -aF | sed -f $0.sed`)
if ($#sfiles != 0) then
    if (-e /tmp/ckrcsFiles$$) then
	foreach file ($sfiles)
	    set extras=($extras `echo $file | fgrep -v -f /tmp/ckrcsFiles$$`)
	end
    else
	set extras=($sfiles)
    endif
endif

rm -f /tmp/ckrcsFiles$$

if ($#extras != 0) then
    echo "files on the server not mentioned in the Makefile (not fatal):"
    foreach file ($extras)
	echo "    $file"
    end
    echo ""
    echo ""
    echo ""
endif

if ($#locked != 0) then
    echo "files that are locked under rcs on the server (not fatal):"
    foreach file ($locked)
	echo "    $file"
    end
    echo ""
    echo ""
    echo ""
endif

if (($#norcsfiles == 0) && ($#nonfiles == 0) && ($#rcsmods == 0)) exit 0

if ($#nonfiles != 0) then
    echo "files listed in Makefile that don't exist (fatal):"
    foreach file ($nonfiles)
	echo "    $file"
    end
    echo ""
    echo ""
    echo ""
endif

if ($#norcsfiles != 0) then
    echo "files to be released that are not under rcs on the server (fatal):"
    foreach file ($norcsfiles)
	echo "    $file"
    end
    echo ""
    echo ""
    echo ""
endif

if ($#rcsmods != 0) then
    echo "files to be released that are different than rcs (fatal)"
    foreach file ($rcsmods)
	echo "    $file"
    end
    echo ""
    echo ""
    echo ""
endif

exit 1
@


1.3
log
@Fixed file formatting problems on the error lists.
@
text
@d54 1
a54 1
	    set nonfiles=($nonfiles $file)
@


1.2
log
@Updated to allow the use of the new RCS
(which allows branches and is compatible
with AMIGA RCS)
@
text
@d40 1
a40 1
	set locked=($locked `rlog -L -R $file)
d80 3
a82 1
    echo
d90 3
a92 1
    echo
d100 1
a100 1
	echo -n "    $file"
d102 3
a104 1
    echo
d110 1
a110 1
	echo -n "    $file"
d112 3
a114 1
    echo
d120 1
a120 1
	echo -n "    $file"
d122 3
a124 1
    echo
@


1.1
log
@Initial revision
@
text
@d23 1
d36 9
a44 6
cd $2
foreach file (`cat /tmp/ckrcsFiles$$`)
    if (-e $file,v) then
	if (! -e RCS) then
	    mkdir RCS
	    echo "RCS directory created in $2"
d46 1
a46 6
	mv $file,v RCS
	set movedrcs=($movedrcs $file)
    endif
    if (-e RCS/$file,v) then
	set locked=($locked `rlog -L -R $file`)
	co -p -q $file | cmp -s - $localdir/$file
d50 6
a55 2
    else 
	set norcsfiles=($norcsfiles $file)
d59 1
d62 1
a62 1
set sfiles=(`ls -aF | sed -f $0.sed`)
a74 8
if ($#movedrcs != 0) then
    echo "rcs files moved on the server into the RCS directory (not fatal):"
    foreach file ($movedrcs)
	echo "    $file"
    end
    echo
endif

d91 1
a91 1
if (($#norcsfiles == 0) && ($#rcsmods == 0)) exit 0
d93 4
a96 53
set sedstring1='s/^locks:  *\([^:]*\):.*/\1/p'
set sedstring2='s/.*$Header: [^ ]* \([0-9.]*\) .*/\1/p'
set answer=n
if ($#rcsmods != 0) then
    echo "files to be released that are different than rcs (fatal)"
    foreach file ($rcsmods)
	if ("$answer" == "N") then
	    echo "    $file"
	    continue
	endif
	set answer=Q
	while ("$answer" == "Q")
	    echo -n "    $file		"
	    set locked=(`rlog -L -R -l$user $file`)
	    if ($#locked == 0) then
		set locked=(`rlog -L -h $file | sed -n "$sedstring1"`)
		if ($#locked != 0) then
		    echo "file locked by user $locked[1]"
		    break
		endif
		set locrev=(`sed -n "$sedstring2" $localdir/$file`)
		if ($#locrev == 0) then
		    echo '(no local $Header$, cannot check revision)'
		    break
		endif
		set rcsrev=`rlog -h $file | sed -n "s/^head:  *//p"`
		if ("$rcsrev" == "$locrev[1]") then
		    echo -n "check out/in file [n/N/y/d/q]?"
		    set answer=$<
		    if ("$answer" == "y") then
			rcs -l -q $file
			set locked=(`rlog -L -R -l$user $file`)
		    endif
		else
		    echo "local rev ($locrev[1]) != rcs rev ($rcsrev)"
		    break
		endif
	    else
		echo -n "check in file [n/N/y/d/q]?"
		set answer=$<
	    endif
	    if ("$answer" == "d") then
		co -p -q $file | diff - $localdir/$file | more
		set answer=Q
		continue
	    endif
	    if ("$answer" == "q") exit 1
	    if ("$answer" == "y") then
		cd $localdir
		ci -u $2/$locked[1]
		cd $2
	    endif
	end
a100 1
set answer
d104 9
a112 16
	if ("$answer" == "N") then
	    echo "    $file"
	else
	    echo -n "    $file		create rcs file [n/N/y/q]?"
	    set answer=$<
	    if ("$answer" == "q") exit 1
	    if ("$answer" == "y") then
		if (! -e RCS) then
		    mkdir RCS
		endif
		cd $localdir
		rcs -i -c"*   " $2/RCS/$file,v
		ci -u$1.0 $2/RCS/$file,v
		cd $2
	    endif
	endif
@
