-
-
Save neowinx/8038684 to your computer and use it in GitHub Desktop.
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
Migrates multiple SVN repos to GitHub, without anything fancy (no Ruby, no dependencies, no issues with Cygwin paths). SVN tags are created as Git tags and properly pushed to GitHub. To run: | |
1) Edit run-authors.sh to have your SVN repos. Run it to get an authors.txt file. | |
2) Edit the authors.txt to have GitHub names and emails if you like. You must use GitHub user email addresses if you want contributions to be associated with GitHub accounts. | |
3) Create the GitHub projects, without populating it with a readme or license. | |
4) Edit run-convert.sh to have your SVN repos, GitHub user URL, and GitHub project name. Run it. | |
5) Done! |
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
svn_url=$1; | |
github_url=$2; | |
name=$3; | |
echo "Cloning SVN repository to $name.svn... $svn_url" | |
rm -rf $name.svn | |
git svn clone $svn_url --no-metadata -A authors.txt --stdlayout $name.svn | |
cd $name.svn | |
echo "Creating .gitignore file..." | |
git svn show-ignore > .gitignore | |
git add .gitignore | |
git commit -m 'Convert svn:ignore properties to .gitignore.' | |
echo "Initializing git repository... $name.git" | |
cd .. | |
rm -rf $name.git | |
git init --bare $name.git | |
cd $name.git | |
git symbolic-ref HEAD refs/heads/trunk | |
echo "Pushing to git repository... $name.git" | |
cd ../$name.svn | |
git remote add bare ../$name.git | |
git config remote.bare.push 'refs/remotes/*:refs/heads/*' | |
git push bare | |
echo "Renaming trunk to master..." | |
cd ../$name.git | |
git branch -m trunk master | |
echo "Converting SVN tag branches to git tags..." | |
git for-each-ref --format='%(refname)' refs/heads/tags | cut -d / -f 4 | | |
while read ref | |
do | |
git tag -a "$ref" -m "Tag: $ref" "refs/heads/tags/$ref"; | |
git branch -D "tags/$ref"; | |
done | |
echo "Pushing to github... $github_url$name" | |
git push --mirror --follow-tags $github_url$name | |
echo "Done!" |
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
sh convert.sh http://reflectasm.googlecode.com/svn https://github.com/EsotericSoftware/ reflectasm | |
sh convert.sh http://kryo.googlecode.com/svn https://github.com/EsotericSoftware/ kryo | |
sh convert.sh http://minlog.googlecode.com/svn https://github.com/EsotericSoftware/ minlog | |
sh convert.sh http://kryonet.googlecode.com/svn https://github.com/EsotericSoftware/ kryonet | |
sh convert.sh http://reflectasm.googlecode.com/svn https://github.com/EsotericSoftware/ reflectasm | |
sh convert.sh http://jsonbeans.googlecode.com/svn https://github.com/EsotericSoftware/ jsonbeans | |
sh convert.sh http://yamlbeans.googlecode.com/svn https://github.com/EsotericSoftware/ yamlbeans | |
sh convert.sh http://table-layout.googlecode.com/svn https://github.com/EsotericSoftware/ tablelayout | |
sh convert.sh http://wildcard.googlecode.com/svn https://github.com/EsotericSoftware/ wildcard | |
sh convert.sh http://scar.googlecode.com/svn https://github.com/EsotericSoftware/ scar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment