#!/bin/bash export LC_ALL=C usage() { echo "Usage: $(basename $0) BRANCH [MESSAGE]" echo echo "Message is optional, you must run this script within a svn tree." echo exit 1 } BRANCH="$1" MESSAGE="$2" [[ -z ${BRANCH} ]] && usage [[ -z ${Message} ]] && MESSAGE="created branch '${BRANCH}'" URI="$(svn info | grep '^URL:' | cut -d' ' -f2)" [[ $? -ne 0 ]] && usage REPO_ROOT="$(svn info | grep 'Repository Root:' | cut -d' ' -f3)" [[ $? -ne 0 ]] && usage echo "creating branch ${URI} with '${BRANCH}'..." svn copy -m "${MESSAGE}" "${URI}" "${REPO_ROOT}/${SUBDIR}/branches/${BRANCH}"