We use SubGit for migrations of projects from SVN to GIT and have encounter a problem with projects, which changed their location in SVN
Let’s assume PROJECT-A with its trunk, tags and brunches folders is located in http://svn.server/repo/sub-folder/PROJECT-A. At some moment in its history the entire project was moved to another folder and then restored.
r10001: svn mv –m “moving to a wrong location” http://svn.server/repo/sub-folder/PROJECT-A http://svn.server/repo/wrong-folder/.
r10002: svn mv –m “moving project back to sub-folder” http://svn.server/repo/wrong-folder/PROJECT-A http://svn.server/repo/sub-folder/.
The commits we get in GIT after applying SubGit are moving project back to sub-folder
and all later commits. However everything that has happened before moving to a wrong location
does not get migrated, although svn log
shows the entire history of commits.
Does subgit has an option to import (install) all commits under the provided SVN url? Currenlty it works like with --stop-on-copy
SubGit always works with the SVN URL you specify and never notices anything beyond it. That's why if you specfy
http://svn.server/repo/sub-folder/PROJECT-A
as SVN URL, it will completely ignore
http://svn.server/repo/wrong-folder/PROJECT-A
as it is beyond this URL.
Fortunately, there's a work-around for your situation. Try the following configuration:
[svn]
...
url = http://svn.server/repo
trunk = sub-folder/PROJECT-A/trunk:refs/heads/master
branches = sub-folder/PROJECT-A/branches/*:refs/heads/*
tags = sub-folder/PROJECT-A/tags/*:refs/tags/*
shelves = sub-folder/PROJECT-A/shelves/*:refs/shelves/*
branches = wrong-folder/PROJECT-A/trunk:refs/heads/wrong/master
branches = wrong-folder/PROJECT-A/branches/*:refs/heads/wrong/*
tags = wrong-folder/PROJECT-A/tags/*:refs/tags/wrong/*
branches = wrong-folder/PROJECT-A/shelves/*:refs/shelves/wrong/*
I guess, you understand the idea: use repository root as SVN URL and add prefixes to the branches paths.
Alternatively you could try to use --layout auto
feature of "subgit configure":
subgit configure --svn-url http://svn.server/repo --layout auto --trunk sub-folder/PROJECT-A/trunk repo.git
This variant of "subgit configure" will scan the SVN history and will detects all directories the trunk was copied to and from and consider them as directories. Then it will generate repo.git/subgit/config
file with corresponding trunk/branches/tags/shelves options. I don't recommend you to 100% rely on this automatic suggestion. You can use those generated options as inspiration but I encourage you to write the mapping manually.