gitsvnrepositorygit-svnsvn2git

How do I checkout an entire SVN repository with all the history, tags and versions


I have a very large SVN repository (nearly 6000 revisions) which I need to migrate to Git. The repository is hosted on an internal server. I want to migrate all the history, tags and versions to Git and have branches etc in Git format.

So far, I have TortoiseSVN installed on my machine and have been trying to use git svn clone, however, a lot of the folders are too large and I get chunk size errors. At the same time, some files have illegal characters in their file path and so are skipped during migration.

I have also attempted to checkout a working copy into my local machine using TortoiseSVN and then try and migrate it by setting up a local svnserve (set up as a Windows service), but, I can never make it work to be able to reach the files using svn://localhost/... I followed a guide (https://subversion.open.collab.net/articles/svnserve-service.htm) to set it up as a service and I can reach e.g. svn://localhost/dev, but, when I checkout files into this folder via Tortoise, it doesn't see them via svn://localhost/dev/<sub-folder> Obviously I'm doing something wrong, but, I'm not sure what.

The structure is as follows:

repository (top level)
 - folder 1
   - sub-folder 1
   - sub-folder 2
   - ...
 - folder 2
   - sub-folder 1
   - ...
 - ...

Lastly, I have tried to use svn2git, but, I get errors in this case too.

What is the best way to do the migration and/or what am I doing wrong? Any help is appreciated!


Solution

  • For a one-time migration git-svn is not the right tool for conversions of repositories or parts of repositories. It is a great tool if you want to use Git as frontend for an existing SVN server, but for one-time conversions you should not use git-svn, but svn2git which is much more suited for this use-case.

    There are plenty tools called svn2git, the probably best one is the KDE one from https://github.com/svn-all-fast-export/svn2git. I strongly recommend using that svn2git tool. It is the best I know available out there and it is very flexible in what you can do with its rules files.

    I guess you instead used the nirvdrum svn2git one. That one effectively calls git-svn and then does some post-processing to overcome some of the drawbacks of git-svn, but you get the same errors of course you get with git-svn.

    You will be easily able to configure svn2gits rule file to produce the result you want from your current SVN layout, including any complex histories like yours that might exist and including producing several Git repos out of one SVN repo or combining different SVN repos into one Git repo cleanly in one run if you like.

    If you are not 100% about the history of your repository, svneverever from http://blog.hartwork.org/?p=763 is a great tool to investigate the history of an SVN repository when migrating it to Git.


    Even though git-svn or the nirvdrum svn2git is easier to start with, here are some further reasons why using the KDE svn2git instead of git-svn is superior, besides its flexibility:

    You see, there are many reasons why git-svn is worse and the KDE svn2git is superior. :-)