Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn to git migration with nested svn:externals

Migrating from svn with svn externals, to git. Each svn externals may have it's own svn:externals. There is no guide how to migrate svn with externals to git here that I found useful. Each branch may have it's own branches tags trunk. What's the best way to migrate the whole repository? I am looking at git svn clone of the main repository adding git submodules, of each one external cloned as well. But Since the externals are nested, I don't know what's the best solution. Script used till now:

https://github.com/eneroth/git-externals
https://github.com/eneroth/git-externals
like image 434
Marco Savo Avatar asked Oct 30 '22 10:10

Marco Savo


1 Answers

I have my own research and I didn't found an all-in-one solution from the opensource. There is plenty single "one sided" solutions which are does not cover many aspect of svn-to-git conversion like:

  • svn:externals
  • svn:ignore conversion into .gitignore
  • automatic SVN author emails conversion or prevension to continue without a conversion (for example, GitLab does use account mails to track repo changes (aggregate participation statistics) for an account and would reject to track anything if you forget to convert the mails from author@<repo-guid> after the git-svn tool)
  • svn tags/branches conversion into native git tags/branches
  • handling conversion collisions or unavailability to convert
  • handling 2-way conversions (git-2-svn)
  • handling conversion resuming (after a commit into one of svn/git repos)
  • handling with out of access to the bare repository or without to access the SVN repository root
  • handling a manual conversion start/resume (through the script or executable) instead of as a standalone service or vice versa
  • support conversion from/into popular svn/git hubs like sourceforge, github, gitlab, bitbucket

...and so on.

It's a pretty big area to invetigate or research to yourself and can consume much time to at least find out what you actually need or want from the svn-to-git or whatever conversion.

For myself I've found this as a pretty much close to what i want: https://techbase.kde.org/Projects/MoveToGit/UsingSvn2Git

Example of the rules file: https://cgit.kde.org/kde-ruleset.git/tree/kde-rules-main

Example of the account map: https://cgit.kde.org/kde-ruleset.git/tree/account-map

Script examples to pack/push from the local bare git repository (generates by the KDE tool) to the remote git repository: https://phabricator.wikimedia.org/diffusion/OSOF/browse/master/svn2git/scripts

Third party projects to scan the SVN repo before slice it:

  • https://github.com/hartwork/svneverever

Some of ports to other third party projects:

  • https://github.com/mazong1123/svn2gitnet (dot net port of the ruby tool)
  • http://rsvndump.sourceforge.net (like the svnrdump, but additionally allow dumps of subdirectories even if your repository access is limited to this subdirectory)

Some standalone interesting implementations:

  • https://gitlab.com/esr/reposurgeon (some comparison from the author: http://www.catb.org/~esr/reposurgeon/features.html)

But still, there is many not resolved aspect or cons like:

  • support git subtree/submodules/etc to slice SVN repo into one GIT root repo with references to other small GIT repos
  • automatic conversion of svn:externals to git subtrees (the rules from the KDE project does support only a manual or semi automatic (regular expressions) conversion)

If you decide to use the KDE convertor, then you can write a script to prepare the rules for each revision range what you want translate for svn:externals into what you want.

like image 182
Andry Avatar answered Dec 09 '22 15:12

Andry