Last active
March 30, 2017 18:58
-
-
Save stg7/100aec3407c4a3d6baee00679b6181e5 to your computer and use it in GitHub Desktop.
Porting a svn to git
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 | |
# please install git-svn | |
input_svn="url/to/svn/like/for/checkout" | |
output_git="url/to/git/like/for/cloning" | |
mkdir -p _svn | |
mkdir -p _git | |
svn co "$input_svn" _svn | |
cd _svn | |
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt | |
cat authors-transform.txt | |
if [[ -f "../authors-transform.txt" ]]; then | |
cp "../authors-transform.txt" . | |
else | |
echo "please change authors-transform.txt to authorSVNName = first last <email>" | |
read | |
fi | |
git svn clone "$input_svn" --no-metadata -A authors-transform.txt ../_git | |
cd ../_git | |
git remote add origin "$output_git" | |
git push -u origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment