#!/bin/sh
#=============================================================================#
#                       Import branches from svn to git                       #
#=============================================================================#
# Denis Smirnov                                                               #
#=============================================================================#
svn_fetch()
{
    export GIT_SVN_NO_LIB=1
    if [ ! -d .git/refs/remotes/$2 ]; then
	git svn init -i $1 $2
    fi
    git svn fetch -i $1
}

# Updating
while read name repo; do
    if [ -z "$name" ]; then
	exit 0
    fi
    if [ -z "$repo" ]; then
	echo "Repo not defined for $name"
	exit -1
    fi
    echo "Updating $name..."
    svn_fetch "$name" "$repo"
done < .gear-svn
