Tip #468 Moved Trac and Subversion repositories to another machine/direct
CASE: You've relocated Subversion and Trac repositories to another machine/directories. You don't want to edit n+1 trac.ini files.You have for example:
/repos/svn-myprojects/my-first-project
/repos/trac-myprojects/my-first-project
/repos/svn-myprojects/my-second-project
/repos/trac-myprojects/my-second-project
...etc...
Change ALL trac.ini repository_dir settings:
trac-mass-repodir-edit.sh:
#!/bin/bash TRACSPATH=$1 REPOPATH=$2 for i in $( find $TRACSPATH -maxdepth 1 -type d | grep -v "^$TRACSPATH\$" ); do BN=`basename $i` INIPATH=$i/conf/trac.ini TMP=$i/conf/trac.ini-temp # Replace repository_dir cat $INIPATH | perl -pe "s@repository_dir = .*@repository_dir = $REPOPATH/$BN@i" > $TMP mv $INIPATH $INIPATH-old && mv $TMP $INIPATH && rm $INIPATH-old done
Usage:
./trac-mass-repodir-edit.sh /repos/trac-myprojects /repos/svn-myprojects
Then you want to resync and upgrade all existing Tracs:
trac-mass-upgrade.sh:
#!/bin/bash TRACSPATH=$1 REPOPATH=$2 for i in $( find $TRACSPATH -maxdepth 1 -type d | grep -v "^$TRACSPATH\$" ); do BN=`basename $i` # SVN directory exists if [ -d $REPOPATH/$BN ]; then echo "Processinc Trac: $BN.." trac-admin $i resync trac-admin $i upgrade fi done
Usage:
./trac-mass-upgrade.sh /repos/trac-myprojects /repos/svn-myprojects
Now you have everything in order.
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs