#!/bin/bash if [[ $1 == "--help" || $1 == "-help" || $1 == "-h" ]]; then cat - << EOUsage Usage: $0 [--help || --test] [dir1 dir2 ...] --help : Shows this help message. Must be first argument. --test : Flag to indicate relocate command(s) should be printed rather than executed. Must be first argument. dir : The directory to relocate. If ommitted, all directories in the current working directory will be tested. If they are in SVN, they will be relocated. EOUsage exit 0; fi myDirs=`ls`; debug=0; if [ $1 == "--test" ]; then debug=1; shift; fi if [ $1 != "" ]; then myDirs=$@; fi for dir in $myDirs; do if [ -d $dir ]; then cd $dir; oldSvn=`svn info 2> /dev/null | grep 'URL: ' | awk '{print $2}'`; if [ "${oldSvn}" != "" ]; then newSvn=${oldSvn/ehptools/ghttrac}; newSvn=${newSvn/\/svn\//\/websvn\/}; if [ $newSvn != $oldSvn ]; then command="svn switch --relocate "; command="${command} ${oldSvn} ${newSvn} . --username=`whoami`"; echo $command; if [ $debug -eq 0 ]; then `$command`; fi else echo "It seems $dir was already relocated." 1>&2; fi else echo "$dir was not a working copy." 1>&2; fi cd - > /dev/null 2>&1; else # Was not a directory echo "$dir was not a directory." 1>&2; fi done