Perche migrare
SVN funziona da due decenni. Ma il suo modello centralizzato, il branching lento e la difficolta di integrazione con tooling moderno spingono la maggior parte dei team verso Git.
Due percorsi di migrazione
- git-svn - bridge tra i due sistemi.
- Conversione one-shot.
Preparare
# authors.txt
jdoe = Jane Doe <[email protected]>
bsmith = Bob Smith <[email protected]>
svn log --xml https://svn.example.com/repo \
| grep author | sort -u \
| sed -E 's/.*>(.+)<.*/\1 = \1 <\[email protected]>/'
Conversione one-shot con git-svn
git svn clone \
--stdlayout \
--authors-file=authors.txt \
https://svn.example.com/repo \
repo.git
cd repo.git
git for-each-ref refs/remotes/origin/tags --format='%(refname:short)' \
| while read ref; do
tag="${ref#origin/tags/}"
git tag "$tag" "$ref"
git branch -d -r "$ref"
done
Pushare a un host Git
git remote add origin https://gitlab.example.com/team/repo.git
git push -u origin --all
git push origin --tags
Verificare la migrazione
- Confrontare i conteggi commit.
- Spot-check su autori e date.
- Conteggi tag e branch dovrebbero corrispondere.
Gestire gli externals
- Vendorizzare il codice esterno.
- Usare submodule Git.
- Usare package manager.
Decommissionare SVN
Dopo la verifica, congelare il repo SVN (read-only).