#!/bin/sh usage () { cat <" exit 1 fi trunk=`svn info | awk '/^URL:/ { print $2 }'` tags=`echo $trunk | sed -E 's/(trunk$|branches\\/[^\\/][^\\/]*$)/tags/'` message="Tagging $trunk as $2" echo $message /usr/bin/svn cp -m "$message" $trunk $tags/$2 echo $tags/$2 ;; branch) if [ $# -lt 2 ] then echo "Usage: svn branch " exit 1 fi trunk=`svn info | awk '/^URL:/ { print $2 }'` branches=`echo $trunk | sed -E 's/(trunk$|(branches|tags)\\/[^\\/][^\\/]*$)/branches/'` message="Creating branch $2 from $trunk" echo $message /usr/bin/svn cp -m "$message" $trunk $branches/$2 echo $branches/$2 ;; merge) if [ $# -lt 2 ] then echo "Usage: svn merge " exit 1 fi trunk=`svn info | awk '/^URL:/ { print $2 }'` branches=`echo $trunk | sed 's/trunk$/branches/'` echo "Merging $2 into the current working copy" # Temporarily disabled --reintegrate merges # svn server needs updated. if [ "$2" = "trunk" ] then /usr/bin/svn merge $trunk . else /usr/bin/svn merge $branches/$2 . fi ;; switchtag|st) if [ $# -lt 2 ] then echo "Usage: svn switchtag " exit 1 fi working=`svn info | awk '/^URL:/ { print $2 }'` tags=`echo $working | sed -E 's/trunk$/tags/; s/(tags|branches)\/[^\/]*$/tags/;'` echo "Switching working copy to tag $2" /usr/bin/svn switch $tags/$2 . ;; switch|sw) if [ $# -lt 2 ] then echo "Usage: svn switch " exit 1 fi working=`svn info | awk '/^URL:/ { print $2 }'` if [ "$2" = "trunk" ] then trunk=`echo $working | sed -E 's/(branches|tags)\/[^\/]*$/trunk/'` echo "Switching working copy to trunk" /usr/bin/svn switch $trunk . else branches=`echo $working | sed -E 's/trunk$/branches/; s/(tags|branches)\/[^\/]*$/branches/;'` echo "Switching working copy to branch $2" /usr/bin/svn switch $branches/$2 . fi ;; help|-h|--help) if [ $# -lt 2 ] then /usr/bin/svn help usage else /usr/bin/svn "$@" fi ;; *) /usr/bin/svn "$@" ;; esac