#!/bin/csh -xv

# usage newBranch origVersion file

set file = $2

set rev = `rcsVers $1 $file`
if ( $status ) then
        echo Revision $1 of $file does not exist
        exit(1)
endif
if ! { co -p -r$rev $file >& /dev/null } then
        echo "No version $rev for file $file"
        exit(2)
endif
set branchNum = 1
while { co -p -r$rev.$branchNum $file >& /dev/null }
#       echo branch $rev.$branchNum already exists
        @ branchNum++
end
echo $rev.$branchNum

