SVN - Reintegration Merge error: "must be ancestrally related"

SvnTortoisesvn

Svn Problem Overview


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?

Svn Solutions


Solution 1 - Svn

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 - Svn

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 - Svn

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 - Svn

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 - Svn

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.

Solution 6 - Svn

This error might occur if you have a file named exactly like one of the branches (or trunk):

# svn switch ^/trunk
Updated to revision 123.
# ls
file1
file2
v1
# svn merge --reintegrate ^/branches/v1
svn: E195016: ^/branches/v1@123 must be ancestrally related to ^/trunk/v1@123

To solve this add current dir to the command (note the dot):

# svn merge --reintegrate ^/branches/v1 .

This is a real life example, it costed me couple of very unpleasant hours. :(

Solution 7 - Svn

I had the same problem. I fixed it by correctly cd on which I merged. I was merging in the path directory to project not in the path directory to trunk ( who is the actual ancestor).

Solution 8 - Svn

I was merging with another project. Caused this issue. I merged with the correct branch then it worked fine. My bad, dyslexia

Solution 9 - Svn

I've had the same error and the reason was about permissions.

The problem was because one developer tries to integrate changes from one branch he has read/write access to another one he also has read/write access but the last one is a branch created from another branch which he just has a read access.

Here is the structure with permissions (r = read, w = write):

trunk (r) develop (r) QA (rw) branches featureBranch1 (rw)

In this case, develop has been created from trunk, QA from develop and featureBranch1 from develop. The fact that he try to reintegrate featureBranch1 into QA which was a branch created from develop and he don't have access in write to develop is in our case the problem why he receive this message when trying to reintegrate featureBranch1 in QA.

Immediately after giving him access in write to develop, the message disappear.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSeibarView Question on Stackoverflow
Solution 1 - SvndavebytesView Answer on Stackoverflow
Solution 2 - SvnLeonidasView Answer on Stackoverflow
Solution 3 - SvnjevonView Answer on Stackoverflow
Solution 4 - SvnMemet OlsenView Answer on Stackoverflow
Solution 5 - SvnJunaedView Answer on Stackoverflow
Solution 6 - SvnalxView Answer on Stackoverflow
Solution 7 - SvnDragosView Answer on Stackoverflow
Solution 8 - SvnZeusView Answer on Stackoverflow
Solution 9 - SvnSamuelView Answer on Stackoverflow