comparison .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
comparison
equal deleted inserted replaced
45:9b1e270ebbf6 46:8946e6ae2747
10 url=`svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` 10 url=`svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'`
11 if [ x"$url" = "x" ] ; then 11 if [ x"$url" = "x" ] ; then
12 url=`git svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` 12 url=`git svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'`
13 fi 13 fi
14 if [ x"$url" = "x" ] ; then 14 if [ x"$url" = "x" ] ; then
15 local dir 15 local dir
16 dir=$1 16 dir=$1
17 if [ x"$dir" = "x" ] ; then 17 if [ x"$dir" = "x" ] ; then
18 dir="." 18 dir="."
19 fi 19 fi
20 url=`hg -R $dir svn info 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` 20 url=`hg -R $dir svn info 2> /dev/null | grep '^URL: ' | sed 's/URL: //'`
21 fi 21 fi
22 if [ x"$url" = "x" ] ; then 22 if [ x"$url" = "x" ] ; then
23 echo -n 'No repo found (tried svn, git-svn, hgsvnclient)' 23 echo -n 'No repo found (tried svn, git-svn, hgsvnclient)'
24 fi 24 fi
25 echo $url 25 echo $url
26 }
27
28 function hg-svn-mkbranch() {
29 local upstream
30 upstream=$(hg svn url)
31 local branchname
32 if [ "x$1" = "x" ] ; then
33 echo 'Must provide new branch name.'
34 return 1
35 fi
36 local d=`hg svn info | grep URL | sed 's/.*://'`
37 local br=`echo $d | awk '{
38 if ( index($1, "trunk") ) {
39 print "trunk"
40 } else {
41 x = index($1, "branches") ;
42 if ( x != 0 ) {
43 sub(".*/branches/", "");
44 sub("/.*", "");
45 print $0
46 }
47 }
48 }'`
49
50 branchname=$br
51 echo svn cp $upstream/$branchname $upstream/branches/$1 -m \"Creating branch $1\"
26 } 52 }
27 53
28 # Function to clean locks out of svn wcs 54 # Function to clean locks out of svn wcs
29 function clean_svn_source_trees() { 55 function clean_svn_source_trees() {
30 for aa in */ ; do 56 for aa in */ ; do