Mercurial > dotfiles
diff .shell.d/50.vcs_functions.sh @ 46:8946e6ae2747
Stopgap hg-svn-mkbranch command to save me typing until the feature goes into hgsubversion itself.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 09 Feb 2009 15:04:30 -0600 |
parents | 62bfb554ab85 |
children | e80bc65439ac |
line wrap: on
line diff
--- 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