Manipulating CVS/Root files
November 24, 2007
To see which CVS repository is being pointed at by the various subdirectories of a local CVS project checkout:
find . -path "*CVS/Root" -exec cat {} \;
And to change the target CVS repository from 192.168.1.4 to say 192.168.1.2 (after moving the repository to a new server) without having to check-out your project once more, just edit all CVS/Root files as follow:
find . -path "*CVS/Root" -exec sed -i tmp -e "s/192.168.1.4/192.168.1.2/" {} \;
If you are moving your cvs repository to a new host, it could be a good idea to check that all the CVS/Root files of your local project point to the same repository. You don't want to commit some changes against the old repository and some against the new one... In a .bash_profile or similar, you could just write something like:
cd $PROJECT
COUNT_ROOTS=`find . -path "*CVS/Root" -exec cat {} \; | sort | uniq | wc -l`
if [ $COUNT_ROOTS -ne "1" ]; then
echo "ERROR: project refers to more than 1 cvs repository!";
# exit swiftly
fi
# all green
find . -path "*CVS/Root" -exec cat {} \;
And to change the target CVS repository from 192.168.1.4 to say 192.168.1.2 (after moving the repository to a new server) without having to check-out your project once more, just edit all CVS/Root files as follow:
find . -path "*CVS/Root" -exec sed -i tmp -e "s/192.168.1.4/192.168.1.2/" {} \;
If you are moving your cvs repository to a new host, it could be a good idea to check that all the CVS/Root files of your local project point to the same repository. You don't want to commit some changes against the old repository and some against the new one... In a .bash_profile or similar, you could just write something like:
cd $PROJECT
COUNT_ROOTS=`find . -path "*CVS/Root" -exec cat {} \; | sort | uniq | wc -l`
if [ $COUNT_ROOTS -ne "1" ]; then
echo "ERROR: project refers to more than 1 cvs repository!";
# exit swiftly
fi
# all green