# HG changeset patch # User Augie Fackler # Date 1234213470 21600 # Node ID 8946e6ae27478887f1db25ae53a96ee4e46e93c2 # Parent 9b1e270ebbf69b020f9cf5d08dde721f0ac4ac9e Stopgap hg-svn-mkbranch command to save me typing until the feature goes into hgsubversion itself. diff --git a/.shell.d/50.vcs_functions.sh b/.shell.d/50.vcs_functions.sh --- a/.shell.d/50.vcs_functions.sh +++ b/.shell.d/50.vcs_functions.sh @@ -12,11 +12,11 @@ function svnurlof() { url=`git svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` fi if [ x"$url" = "x" ] ; then - local dir - dir=$1 - if [ x"$dir" = "x" ] ; then - dir="." - fi + local dir + dir=$1 + if [ x"$dir" = "x" ] ; then + dir="." + fi url=`hg -R $dir svn info 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` fi if [ x"$url" = "x" ] ; then @@ -25,6 +25,32 @@ function svnurlof() { echo $url } +function hg-svn-mkbranch() { + local upstream + upstream=$(hg svn url) + local branchname + if [ "x$1" = "x" ] ; then + echo 'Must provide new branch name.' + return 1 + fi + local d=`hg svn info | grep URL | sed 's/.*://'` + local br=`echo $d | awk '{ + if ( index($1, "trunk") ) { + print "trunk" + } else { + x = index($1, "branches") ; + if ( x != 0 ) { + sub(".*/branches/", ""); + sub("/.*", ""); + print $0 + } + } + }'` + + branchname=$br + echo svn cp $upstream/$branchname $upstream/branches/$1 -m \"Creating branch $1\" +} + # Function to clean locks out of svn wcs function clean_svn_source_trees() { for aa in */ ; do