3 ms·
It's not too hard to migrate from SVN to Git. I did this for a 15+ year old very large code base. I tried various recommended techniques but everything would f
by zaccusl 7y ago
It's not too hard to migrate from SVN to Git.
I did this for a 15+ year old very large code base. I tried various recommended techniques but everything would fail at some point or another (usually after many, many hours) and I'd have to start over.
Finally I wrote a very simple program with logging where the logging also records the current state and on any failure I could start from any point in the log.
The idea was simple.
1. Check out SVN version N
2. Parse the changed files list for file between commit N
and N - 1
3. Copy those files to the Git folder
4. Parse the commit log for version N to get the commit
date, committer name, and commit message
5. Commit in Git using "[<name>@<date>] <message>" (this preserving the original commit information)
6. Repeat with N + 1.
If it fails at anytime then simply reset both SVN and Git to the last successful commit and restart. I also did a binary compare of the entire directory tree every 100 commits to ensure the copies were identical.
The process took about two weeks running all day and night (since one commit at a time is very slow) but it was very robust and left a perfect version history.
To deal with the fact that the SVN repo was still live, I believe I mirrored (or something like that) the repo and would sync between my local mirror and the live repo every couple of days. When my program caught up with the live repo we just stopped commits for a few hours while I wrapped everything up and then archived the SVN repo.