SVN - Reintegration Merge error: "must be ancestrally related"
Using TortoiseSVN - when I use Test Merge, I get the error "http://mysvnserver/svn/main/branches/ProjectA must be ancestrally related to http://mysvnserver/svn/main/trunk/ProjectB"
What can I do to resolve this?
Solution 1:
I just went through a similar problem, wanted to add the issue and solution I hit. The branch was made from a SUBFOLDER of trunk and not the entire tree. Thus, when I tried to reintegrate, I was mismatching hierarchies. Simply restructuring the integrate to be to the proper subfolder of my trunk WD allowed the process to proceed.
Adding in hopes this might aid someone who hits this Q/A. :)
Solution 2:
Let me guess: the projects are not related? Look up the history, if one of them ever was branched or not.
Immediate solution: either merge per hand or try command line with "svn merge --ignore-ancestry"
Solution 3:
As davebytes mentioned, this problem can occur when you branch trunk\X
into branches\Y
, but then move X
into a new folder Z
, i.e. trunk\X\Z
.
If you just try to merge a change on branches\Y
into trunk\X
, you will get lots of conflicts; if you just try to merge branches\Y
into trunk\X\Z
, you will get the "ancestrally related" error.
But, the SVN manual describes the underlying problem: svn merge
should really be called svn diff-and-apply
. What you should instead be trying to describe in this scenario, is that you are trying to sum up the changes that occured from r100 to r200 of branches\Y
, and apply these changes to trunk\X\Z\
.
In TortoiseSVN, this is the merge two different trees scenario to your local working copy of trunk\X\Z
, with r100 of branches\Y
set as "from", and r200 of branches\Y
set as "to".
Solution 4:
We have run into this problem because of the following:
Created a folder with the repo browser of TortoiseSVN and used it as a branch. Afterwards we tried to merge the manually created folder into the work folder.
Solution is: Don't create a branch manually in first place, instead use the TortoiseSVN -> Branch/tag... option to create a branch.
Hopefully this will be helpful.
Solution 5:
At first I tried to merge in the root folder and got the error, then I browsed to the specific folder where I wanted to merge and then selected the right folder to merge from.
Example,
In my branch, I have project structure:
-Root
- Code
- DB
I created a tag and changed into the DB folder of the tag. Now I want to bring the changes of the tag to the branch. So, I switched to my branch and tried to merge and got the error “must be ancestrally related”.
So the solution was,
I browsed to "DB" folder in branch, right click and select Tortoise SVN->Merge-> Merge a range of revisions ->
Now, from the URL to merge from, I selected:
the "DB" folder from my tag.
Then, "test branch". Everything worked fine :D
So, then I clicked the "Merge" button.