diff --git a/git-svn-clone-externals b/git-svn-clone-externals index f374f26..bd72164 100755 --- a/git-svn-clone-externals +++ b/git-svn-clone-externals @@ -5,6 +5,9 @@ set -e toplevel_directory="$(git rev-parse --show-cdup)" [ -n "$toplevel_directory" ] && { echo "please run from the toplevel directory"; exit 1; } +# Specify revision in command line (e.g. -rHEAD) +# It only affects those svn externals that are not tied to a specific revision +revision="$1" function call() { @@ -27,7 +30,8 @@ function do_clone() if [ -d "$local_directory" ]; then ( cd "$local_directory" - call git svn fetch --all + call git svn fetch "$revision" + call git svn rebase ) else tags="tags" @@ -96,12 +100,17 @@ function is_excluded() } -git svn show-externals|grep -vE '#|^$'|while read -a words +declare -a lines +while read -a words ; do + lines[${#lines[@]}]=${words[*]} +done < <(git svn show-externals | grep -vE '#|^$') + +for words in "${lines[@]}" do + words=($words) [ -z "${words[*]}" ] && continue local_directory="$(echo ${words[0]}|sed 's,^/,,')" - revision="" remote_url="${words[1]}" check_excluded=$(is_excluded $local_directory)