Skip to content

Instantly share code, notes, and snippets.

@ChristianWitts
Created January 17, 2018 08:47
Show Gist options
  • Save ChristianWitts/d618fbed89988d6f0742c807f4dbe72d to your computer and use it in GitHub Desktop.
Save ChristianWitts/d618fbed89988d6f0742c807f4dbe72d to your computer and use it in GitHub Desktop.
Convert SVN Repository to Git
#!/usr/bin/env bash
set -eou pipefail
# Atlassian has a script to aid in some tasks [1]
# This is to create a case sensitive file-system specifically for macOS [2]
java -jar ~/svn-migration-scripts.jar create-disk-image 5 GitMigration
SVN_DOMAIN=""
# List the SVN Project Name and corresponding Git name 1-for-1
SVN_PROJECTS=()
GIT_PROJECTS=()
cd GitMigration
SVN_BASE="$(pwd)"
GIT_BASE="$(pwd)/git"
LENGTH=${#SVN_PROJECTS[*]}
for (( i=0; i<=$(($LENGTH - 1)); i++ ))
do
SVN_PROJECT=${SVN_PROJECTS[$i]}
GIT_PROJECT=${GIT_PROJECTS[$i]}
svnrdump dump https://${SVN_DOMAIN}.svn.cloudforge.com/${SVN_PROJECT} > ${SVN_PROJECT}.dump
svnadmin create ${SVN_PROJECT}
svnadmin load ${SVN_PROJECT} < ${SVN_PROJECT}.dump
git svn clone file://${SVN_BASE}/${SVN_PROJECT} ${GIT_BASE}/${GIT_PROJECT}
done
# [1] https://bitbucket.org/atlassian/svn-migration-scripts/downloads/
# [2] https://www.atlassian.com/git/tutorials/migrating-prepare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment