Tortoise SVN Merge "@### must be ancestrally related to @###" Error
Asked Answered
C

1

5

Backstory: Got a job as an entry level web developer. Head developer leaves right when I start. All responsibility on me. Never used SVN. Going in blind.

Problem:
I keep getting errors like

'svn://svn/svn/xxx/project_name/branches/dev@330' must be
ancestrally related to 'svn://svn/svn/xxx/project_name/trunk@326'

The process by which I am starting the new project is:

  1. Make a directory for the project on my computer with subfolders:
    project_name/branches
    project_name/branches/dev
    project_name/tags
    project_name/trunk

  2. Right click the project root, select my project root, and Add it to the repository

    (All that follows are what I have to do for current projects, and this works no problem in them, but breaks for new projects at the merge)

  3. Commit "dev" branch

  4. Merge "dev" into "trunk" (Merge all revisions) * BREAKS HERE *
  5. Commit "trunk"
  6. svn up, etc

Not being familiar with SVN, I am having a really tough time with this. As I said, doing 3-6 on existing projects works, but on new ones, I get the must be ancestrally related to error on merge. So, what am I doing wrong? All and any help is greatly appreciated.

Candycandyce answered 5/3, 2014 at 17:0 Comment(2)
It sounds like the problem is that you did not create the dev branch via an svn copy, but just by having the directory in your directory structure. Thus the dev folder does not have trunk as an ancestor (it was not created from trunk). I don't know about TortoiseSVN, but in an IDE you would open up your trunk folder and then select branch and then switch over to your new branch.Inseverable
@Inseverable I can't thank you enough. I figured it out! Thank you so much.Candycandyce
F
7

[thatidiotguy][1] is probably right about not creating via a copy from trunk.

If you use svn log --verbose --stop-on-copy on the dev branch, the earliest entry should show where you copied the branch from.

TortoiseSVN's svn log function works the same way; stop on copy is a checkbox in the log window.

If you didn't create it from a copy, then it can't be merged back.

You'd need to recreate the dev branch and reapply your changes.

Update: By "recreate the dev branch", I mean make a new branch for development, which is an actual svn copy (branch) off of the trunk. If you create the branch using svn copy trunk/[application subfolder] branch/[application subfolder - name of branch], svn will record the original source version. This permits intelligent merging of changes in the trunk/base version into the branch (to fix defects, add features, etc.) Once the copy is made, you can copy over the changed files from the original source, and commit them as normal changes to the code.

How to replace a branch in subversion?

https://stackoverflow.com/users/821722/thatidiotguy

Faction answered 5/3, 2014 at 17:53 Comment(2)
Thank you too. The log helped as well.Candycandyce
What do you mean by "recreate the dev branch"?Waligore

© 2022 - 2024 — McMap. All rights reserved.