#!/bin/csh  -xv
#
#
# rcsMakeBranch branchName origRev file

set branchName = $1
set origRev = $2
set file = $3

co -r$origRev $file
set branchVersion = `rcsNewBranch $origRev $file`
if ( $status ) then
        echo "Couldn't get subbranch of $origRev for $file"
        exit 1
endif
if { rcsVers -q $branchName $file } then
        echo "Branch $branchName already exists for file $file"
        exit 1
endif
if ! { fperm $file 222 } then
        echo "File is writable"
        exit 1
endif
ci -m"New branch" -f$branchVersion $file
rcs -N${branchName}:${branchVersion} $file
co -r$branchName $file

