Created
August 26, 2012 09:05
-
-
Save crowding/3476441 to your computer and use it in GitHub Desktop.
Extract a list of SVN URLs to Git repos
This file contains hidden or 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 -ex | |
#little script to migrate an SVN URL into a Git repo | |
#I have already prepared the list of FROM and TO, to be run with | |
# | |
#xargs -L 1 < migration.txt ./migration.sh | |
# | |
#I have made sure that the repos already exist and are empty, or else | |
#will be auto-created by Gitolite. | |
FROM=$1 | |
TO=$2 | |
CWD=`pwd` | |
trap 'exit 255' ERR | |
TMP=`tempfile -s .git -d ${HOME}` | |
trap 'cd "$CWD" && rm -rf "$TMP"' INT TERM EXIT | |
rm "$TMP" | |
mkdir "$TMP" | |
git svn clone "$FROM" "$TMP" | |
cd "$TMP" | |
git remote add origin "$TO" | |
git fetch | |
git push --all | |
cd "$CWD" | |
rm -rf "$TMP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment