aheld
aheld

Reputation: 313

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.

Upvotes: 5

Views: 9301

Answers (3)

aheld
aheld

Reputation: 313

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.

Upvotes: 2

Raheem
Raheem

Reputation: 1

I had the same issue. I right-clicked and chose to revert. That resolved all merge conflict issues.

Upvotes: 0

Sufian
Sufian

Reputation: 6555

Background of the problem

I had made changes to my working copy thinking that if I don't explicitly "commit" them, it won't affect my repo on server.

And to fend-off some warning (don't remember), I used "update" couple of times. After finding my way out of this hole which I myself dug, I understand that "update" command works in following way:

  1. if working copy is modified/latest, it will commit to the repo.
  2. if the repo is latest, it will kind of work like "checkout" (as far as I can understand).

I am using 2 branches (dev and alpha). And I wanted to merge dev branch into alpha.

Steps used to fix

  1. update my alpha to the revision which I intentionally committed,
  2. merged dev into alpha.

Note: I was using SmartSVN.

Upvotes: 0

Related Questions