Created
July 28, 2011 09:55
-
-
Save pyricau/1111307 to your computer and use it in GitHub Desktop.
Convertir un repo SVN en repo Git, avec ceintures et bretelles
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
# On sort la liste des users ayant commité sur le SVN | |
svn log --xml https://svn.codehaus.org/groovy | grep "<author>" | sort -u | sed 's/<[^>]*[>]//g' > users.txt | |
# Compléter le fichier users.txt pour qu'il ait le format suivant (sur certains SVN, le "no author" correspond au premier commit) : | |
user1 = User One <[email protected]> | |
user2 = User Two <[email protected]> | |
(no author) = No Author <[email protected]> | |
# Cloner en local le repo svn (je pars du principe que le svn a la forme classique trunk / branches / tags | |
git svn clone --username glaforge --stdlayout --no-metadata --authors-file users.txt https://svn.codehaus.org/groovy groovy | |
cd groovy | |
# Convertir svn:ignore en un fichier .gitignore | |
git svn show-ignore > .gitignore | |
git add .gitignore | |
git commit -m "Translating svn:ignore to .gitignore" | |
# Convertir les tags SVN en tags Git | |
cp -Rf .git/refs/remotes/tags/* .git/refs/tags/ | |
rm -Rf .git/refs/remotes/tags | |
# Convertir les branches SVN en branches Git | |
cp -Rf .git/refs/remotes/* .git/refs/heads/ | |
rm -Rf .git/refs/remotes | |
rm .git/refs/heads/trunk | |
# Ajouter le repo git (à créer auparavant bien sûr) | |
git remote add origin ssh://[email protected]/groovy-git.git | |
# Pousser toutes les branches | |
git push --all | |
# Si ça marche pas, insulter @sdouche, il avait qu'a pas faire de prez sur le thème Git c'est trop bien :-) | |
# Il faudra probablement recommencer la procédure en créant un repo git différent pour chacun des repos suivants : | |
https://svn.codehaus.org/groovy/sandbox/ | |
https://svn.codehaus.org/groovy/modules/ | |
https://svn.codehaus.org/groovy/gmaven/ | |
https://svn.codehaus.org/groovy/eclipse/ | |
https://svn.codehaus.org/groovy/art/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment