Skip to content

Instantly share code, notes, and snippets.

@pyricau
Created July 28, 2011 09:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pyricau/1111307 to your computer and use it in GitHub Desktop.
Save pyricau/1111307 to your computer and use it in GitHub Desktop.
Convertir un repo SVN en repo Git, avec ceintures et bretelles
# 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 <user1@mail.com>
user2 = User Two <user2@mail.com>
(no author) = No Author <no@author.com>
# 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://git@git.codehaus.org/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