Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: "tree conflict already exists", but there were none before I tried merging

I get this error message from SVN:

svn: Attempt to add tree conflict that already exists

Now, this has already been asked on this site and the given explanation is that a tree conflict has not been resolved after a previous merge, and now SVN is trying to add the same tree conflict again.

So I called "svn status" and marked all tree conflicts as resolved. I then did *svn revert -R ** and double-checked that the output of "svn status" is completely empty. I then tried the merge again, with the exact same error message at the exact same place.

It seems to me like svn tries to add a tree conflict in the very same place twice during the same merge operation, which, with all due respect, would be a severe bug in SVN.

like image 638
aheld Avatar asked Nov 06 '22 16:11

aheld


1 Answers

It seems like the source of this was a folder that I renamed in a way that is not to SVN's liking. Instead of using the svn move command, I renamed the folder locally, deleted the old folder name with svn remove and added the new one with svn add. However, this spawns a "phantom folder" that has the old name - it exists neither in the working copy nor in the repository, but SVN thinks it exists. A phantom folder causes the fatal tree conflict I mentioned above.

Here is how we solved this:

  1. Merge the trunk into the branch. The branch is now what you eventually want your trunk to be.

  2. Create a new branch as a clone of the trunk.

  3. Switch your working directory to the up-to-date branch (i.e. the one you eventually want as the trunk). Use svn diff > update.patch there.

  4. Copy update.patch into the folder of the newly created clone branch.

  5. Switch your working directory to that of the clone branch and apply the patch. The clone branch is now nearly identical with the up-to-date-branch, with one difference: There is no mention of the phantom folder in those hidden svn files.

  6. Merge the clone branch back into the trunk.

like image 75
aheld Avatar answered Nov 15 '22 06:11

aheld