Created
October 4, 2017 13:17
-
-
Save larryprice/f1cc18c302534a4237e9e92715435bc9 to your computer and use it in GitHub Desktop.
svn-migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Arguments: $1 is a directory where the SVN repository already exists | |
# $2 is the remote SVN repo URL | |
# $3 is the URL to the Gitlab site | |
# $4 is the token used to access the Gitlab site | |
# $5 is the Gitlab namespace id new repos will reside in | |
# $6 is the base Gitlab SSH URL (including namespace name) | |
PROJECTS=`ls $1` | |
for project in $PROJECTS | |
do | |
mkdir -p $project | |
pushd $project | |
result=`find $1/$project -name trunk` | |
if [ -z $result ]; then | |
svn2git --notrunk $2/$project | |
else | |
svn2git $2/$project | |
fi | |
curl -X POST $3/api/v4/projects -F "private_token=$4" -F "name=${project:0:-1}" -F "namespace_id=$5" | |
pushd $project | |
git remote add origin $6/${project:0:-1}.git | |
git push --all origin | |
popd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment