Author
Christopher Marshall (christopherlmarshall@yahoo.com)
Raw Notes on CVS: complete branching example
#!/bin/bash
#
# this example demonstrates what happens when a single file is modified on the trunk and the
# branch, then the trunk is merged into the branch.
# if the trunk version of the file and the branch version of the file are the same at the
# merge points, then, there is no conflict and the file is left as-is.
# if there is a conflict, a conflict is declared and the usual markers placed in the text.
CWD=$(pwd)
# create a repository
mkdir CVSROOT
export CVSROOT=${CWD}/CVSROOT
cvs init
# create a project
cd $CWD
mkdir p1
cd ${CWD}/p1
touch A B C
echo "1" > A
echo "2" >> A
echo "3" >> A
cvs import -m "" p1 vtag rtag
cd $CWD
rm -rf p1
# checkout main working copy, create branch
# br1 is the branch name
# and br1-1 is the name of the tag at the branch point (the branchbasetag)
cd ${CWD}
mkdir main; cd main; cvs checkout p1;
cvs tag -b br1 p1
cvs tag br1-root p1
cvs tag mt1-root p1
# checkout branch working copy
cd ${CWD}
mkdir branch; cd branch; cvs checkout -r br1 p1
# tag br1-1
echo ">>> creating br1-1"
cd ${CWD}/branch/p1
echo "4" >> A
echo "CVS COMMIT"
cvs commit -m "1"
cd ${CWD}/branch/
cvs tag br1-1 p1
# tag mt1
echo ">>> creating mt1"
cd ${CWD}/main/p1
echo "4" >> A
echo "CVS COMMIT"
cvs commit -m "1"
cd ${CWD}/main/
cvs tag mt1 p1
# tag br1-2
echo ">>> creating br1-2"
cd ${CWD}/branch/p1
echo "CVS COMMIT"
# uncommenting this creates a conflict
# echo "5" >> A
cvs commit -m "1"
cd ${CWD}/branch/
cvs tag br1-2 p1
# merge main->branch, tag br1-3
echo ">>> creating br1-3"
cd ${CWD}/branch/p1
echo "CVS UPDATE"
cvs update -j mt1-root -j mt1
echo "CVS COMMIT"
cvs commit -m "1"
cd ${CWD}/branch/
cvs tag br1-3 p1
