Skip to content

Instantly share code, notes, and snippets.

@sferich888
Created April 24, 2014 20:18
Show Gist options
  • Save sferich888/11268160 to your computer and use it in GitHub Desktop.
Save sferich888/11268160 to your computer and use it in GitHub Desktop.
script to restore save repositories for save_repo script.
DIR=/tmp/test
FLAG=1
mkdir -p $DIR
START=$(pwd) && cd $DIR
while read line; do
if [[ -z $line ]]; then
FLAG=1
else
if [[ $FLAG == 0 ]]; then
if [[ $(echo $line | awk '{print $1}') == "SVN:" ]]; then
echo "SVN --- "
cd $REPO
echo " adding svn sub directory of $line"
svn checkout $(echo $line | awk -F: '{print $2 ":" $3}')
cd ..
else
cd $REPO
echo " adding <upstream> remote of $line to $REPO"
git remote add upstream $line
cd ..
fi
else
REPO=$(echo $line | awk -F/ '{print $NF}' | cut -d. -f1)
echo "Restoring from: $line into $REPO"
git clone $line
FLAG=0
fi
fi
done < /tmp/REPOS
cd $START
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment