Entire SVN History is not imported

If a subfolder in an SVN repository is renamed or moved to another subfolder, the entire SVN history is not imported into Bitbucket. For example, we have RepoA with a subfolder called “test_later” that was renamed from “test” at some point in time. If we import into Bitbucket the “test_later” folder, it only brings in the history up to the point where the folder name was changed from “test”. Is there a way to bring in the entire history into Bitbucket? We tried to rename the folder back to “test”, but that didn’t help.

Hello Tyler.

SVN Mirror add-on is able to trace history through renames, only on the condition that the rename was done by SVN, not by OS facilities. In such a case, the SVN log does contain information on old and new names of the folder and thus allows to trace its history, so the add-on translates the whole history, including rename. If the rename has been made not by ‘svn move’, then the SVN log only contains information about adding the new folder, so the add-on cannot associate it with the old name and thus the history stops at the renaming point.

Rename the folder back indeed won’t help as the issue occurs at the first renaming, so renaming back is just another issue that doesn’t fix the first one.

It may be possible to import the whole history in such cases, too, but not by SVN Mirror add-on as it doesn’t have features that can handle situations like that automatically. Instead, the repository history may be imported manually using an individual approach for the particular repository. As an example, it may be possible to import two parts of the repository separately (before and after the renaming) and then join the histories by ‘git filter-branch’ or ‘git replace’.

The above note relates mainly to the subfolders inside SVN branches; however, if the folder you are renaming actually is an SVN branch, then the situation differs a little: to trace the history through renaming, you need to add a mapping for the old branch name. For example, assume you had a branch called “old_branch” and you’ve renamed it to “new_branch”. The “new_branch” is included in the mapping configuration, like:

branches = new_branch:refs/heads/new_branch

to translate the whole history add the old branch to the configuration:

branches = new_branch:refs/heads/new_branch
branches = old_branch:refs/heads/old_branch

Actually, the add-on adds this lines on its own if the “Automatic Configuration” layout is used – but, of course, for those branches that were renamed by SVN.

Hope it will help.