From befc0f02138ae0064bddfbe36e2f9675b0237027 Mon Sep 17 00:00:00 2001 From: Johan Martinsson Date: Tue, 3 May 2011 18:39:10 +0200 Subject: [PATCH 1/4] fixed sed regex that calculated module by deleting trunk instead of grabbing the part before trunk --- git-svn-clone-externals | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/git-svn-clone-externals b/git-svn-clone-externals index f374f26..fd30f10 100755 --- a/git-svn-clone-externals +++ b/git-svn-clone-externals @@ -17,8 +17,9 @@ function call() function do_clone() { test -d .git_externals || return 1 - module=`echo $remote_url|sed 's,\(.*\)\(/trunk\|/branch.*\|/tag.*\),\1,'` - branch=`echo $remote_url|sed 's,\(.*\)\(/trunk\|/branch.*\|/tag.*\),\2,'|sed 's,^/,,'` + module=`echo $remote_url|sed 's,\(.*\)\(/trunk.*\|/branch.*\|/tag.*\),\1,'` + branch=`echo $remote_url|sed 's,\(.*\)\(/trunk.*\|/branch.*\|/tag.*\),\2,'|sed 's,^/,,'` + suffix=`echo $branch|sed 's,^\(trunk\|branches\|tags\)\(.*\),\2,'` if [[ $branch = $remote_url ]]; then branch="" fi @@ -41,7 +42,7 @@ function do_clone() # additional options for git-svn call git svn clone "$revision" "$module" "$local_directory" else - call git svn clone "$revision" "$module" -T trunk -b $brch -t $tags "$local_directory" + call git svn clone "$revision" "$module" -T trunk$suffix -b $brch$suffix -t $tags$suffix "$local_directory" fi fi @@ -49,7 +50,7 @@ function do_clone() branch="$(echo ${branch}|sed 's,/$,,')" if [ -n "$branch" ]; then cd "$local_directory" - call git reset --hard $branch + call git reset --hard `echo $branch | sed "s,$suffix,,"` fi ) ) From cd197510c0c97ac5597f3958c6950145a2a673b5 Mon Sep 17 00:00:00 2001 From: Johan Martinsson Date: Wed, 4 May 2011 08:57:36 +0200 Subject: [PATCH 2/4] refactor : extracted an explanatory local variable --- git-svn-clone-externals | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-svn-clone-externals b/git-svn-clone-externals index fd30f10..870ab1f 100755 --- a/git-svn-clone-externals +++ b/git-svn-clone-externals @@ -50,7 +50,8 @@ function do_clone() branch="$(echo ${branch}|sed 's,/$,,')" if [ -n "$branch" ]; then cd "$local_directory" - call git reset --hard `echo $branch | sed "s,$suffix,,"` + branchbase=`echo $branch | sed "s,$suffix,,"` + call git reset --hard $branchbase fi ) ) From 59047b31c3341298cde0b80067702218c2d4ef9e Mon Sep 17 00:00:00 2001 From: Johan Martinsson Date: Fri, 24 Jun 2011 10:49:51 +0200 Subject: [PATCH 3/4] made it possible to launch git-svn-externals-update from the root dir (ie not having to navigate to each svnexternals dir before launch --- git-svn-externals-update | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git-svn-externals-update b/git-svn-externals-update index 9e68f90..2ddc20a 100755 --- a/git-svn-externals-update +++ b/git-svn-externals-update @@ -1,11 +1,11 @@ #!/bin/bash -for dir in *; do +for dir in `find .git_externals/ -name .git -type d -exec dirname {} \;`; do if [ -d $dir ]; then - cd $dir + pushd $dir echo $dir git svn fetch git svn rebase - cd .. + popd fi -done \ No newline at end of file +done From 6d1271f8e86999ade858b4065bfc8224d613d6e9 Mon Sep 17 00:00:00 2001 From: Johan Martinsson Date: Fri, 24 Jun 2011 11:02:17 +0200 Subject: [PATCH 4/4] improved find regex so that the script can be called from any directory where there are .git externals below the current dir - project rootdir - .git_externals - .git_externals/external1 - .git_externals/external2 ... --- git-svn-externals-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-svn-externals-update b/git-svn-externals-update index 2ddc20a..9e347bd 100755 --- a/git-svn-externals-update +++ b/git-svn-externals-update @@ -1,6 +1,6 @@ #!/bin/bash -for dir in `find .git_externals/ -name .git -type d -exec dirname {} \;`; do +for dir in `find . -regex "./.*/.*.git" -type d -exec dirname {} \;`; do if [ -d $dir ]; then pushd $dir echo $dir