'SVN Re-organising a Project that Don't Break Release/Feature Branches

We have an SVN project that currently has a few release branches. We want to re-organise the project in trunk. Since it was a bit of a slapped-together project structure initially. But we would like our release branches to still be able to get bug fixes from trunk or contribute to bug fixes in trunk.

I understand that SVN 'tracks' the tree as well, but it seems like if you move files around it loses the ability to "find" them when you merge to/from older branches. Is there a correct way to move folders so that it stays within SVN's ability to track them for the sake of keeping other branches compatible with merge?

SVN looks like the following:

Repo/
  - trunk/
  - - WebProject/
  - - - WebProjSolution.sln
  - - - ProjectLibraryA/
  - - - - ProjFile1.cs
  - - - WebProject/
  - - - - WebProjFile.cs
  - - ProjectLibraryB/
  - - - ProjFile2.cs
  - branches/
  - - v1.0/
  - - - WebProject/
  - - - - WebProjSolution.sln
  - - - - ProjectLibraryA/
  - - - - - ProjFile1.cs
  - - - - WebProject/
  - - - - - WebProjFile.cs
  - - - ProjectLibraryB/
  - - - - ProjFile2.cs

We want trunk to be updated to the following:

- trunk/
- - source/
- - - WebProjSolution.sln
- - - ProjectLibraryA/
- - - - ProjFile1.cs
- - - - WebProject/
- - - - - WebProjFile.cs
- - - - ProjectLibraryB/
- - - - - ProjFile2.cs

You will notice we want to:

  1. Move all the folders from Repo/trunk/WebProject down to the root folder so that there is only one level of projects.
  2. And we group all the projects in a single "source" root folder.

We have used a process of moving the folders using svn mv SourceFolder ../

When we move the folders one level down (number 1), SVN seems to be able to cope with this but it does complain and then "figure it out":

--- Merging r5 into '.':
   C ProjectLibraryA
--- Recording mergeinfo for merge of r5 into '.':
 U   .
Summary of conflicts:
  Tree conflicts: 1
Searching tree conflict details for 'ProjectLibraryA' in repository:
Checking r2... done
Tree conflict on 'ProjectLibraryA':
Changes destined for a directory arrived during merge of
'^/trunk/ProjectLibraryA:5'.
No such file or directory was found in the merge target working copy.
The directory '^/trunk/WebProject/ProjectLibraryA' was moved to '^/trunk/ProjectLibraryA' in r4 by SvnUser.
Applying recommended resolution 'Apply to corresponding local location':
--- Merging differences between repository URLs into 'WebProject\ProjectLibraryA':
U    WebProject\ProjectLibraryA\ProjFile1.cs
Tree conflict at 'ProjectLibraryA' marked as resolved.
Summary of conflicts:
  Tree conflicts: 0 remaining (and 1 already resolved)

But when we create the source folder inside trunk and then move all the content of this folder down to it. Any changes on the trunk cannot be merged to the v1.0 anymore as it just says there is a "tree conflict" on the source target folder.

Is there a special way to move/record these folder moves to allow SVN to understand that a folder or file moved location based off the common anchestor of the branch and trunk?

I can also "rename" trunk to say trunk_2 and then make a copy of trunk_2 to a the new folders trunk/source if that helps SVN to see trunk_2 as a common anchestor of the new "trunk" and "v1.0" branch.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source