#!/bin/bash #### relocate-wd --- change a working directory's repository # - Run the script provided below at the top of your working # directories, to make them point at the new rep. OLDROOT=:ext:address@hidden:/cvs/guile OLDREP=/cvs/guile/guile NEWROOT=:ext:address@hidden:/cvs/guile NEWREP=/cvs/guile/guile ## Find all the CVS control directories. dirs=`find . -name CVS -type d -print` || exit 1 trap 'rm /tmp/oldroot' 0 1 2 15 ## Make sure they're all pointing at the guile module in the old repository. echo "$OLDROOT" > /tmp/oldroot echo "Checking directory tree..." for dir in $dirs; do ## Check the Root file. if [ ! -f $dir/Root ]; then echo "$dir doesn't have a Root!" >&1 exit 1 fi if ! cmp $dir/Root /tmp/oldroot > /dev/null; then echo "$dir isn't pointing at old root $OLDROOT." >&1 exit 1 fi ## Check the Repository file. if [ ! -f $dir/Repository ]; then echo "$dir doesn't have a Repository!" >&1 exit 1 fi if [ -n "`grep -v ^${OLDREP} $dir/Repository`" ]; then echo "$dir isn't pointing at old module $OLDREP." >&1 exit 1 fi done ## All seems in order; change things. echo "Frobbing tree..." for dir in $dirs; do echo $NEWROOT > $dir/Root || exit 1 sed -e "s:$OLDREP:$NEWREP:" < $dir/Repository > $dir/relocate-tmp || exit 1 mv $dir/relocate-tmp $dir/Repository || exit 1 done