Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 428
mandelbug Avatar asked Mar 05 '14 17:03

mandelbug


People also ask

What is merge in TortoiseSVN?

Where branches are used to maintain separate lines of development, at some stage you will want to merge the changes made on one branch back into the trunk, or vice versa. It is important to understand how branching and merging works in Subversion before you start using it, as it can become quite complex.


1 Answers

[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

like image 55
Ron Ruble Avatar answered Sep 28 '22 04:09

Ron Ruble