svn local obstruction, incoming add upon merge

Posted by Jen Tong on May 20, 2009

If you’ve found this entry, you probably ran into your first SVN Tree conflict. This is also called an ‘evil twin conflict’ in some other revision control systems.

The message generated by svn merge or later svn stat operations will look something like this:

A     C web-app/images/widget.png
      >   local obstruction, incoming add upon merge
Summary of conflicts:
  Tree conflicts: 1

The Cause

This special conflict message is created when the same file has been added to both the place your merging from as well as the place your merging to since the last merge. Since these evil twins both have completely different histories and no common state (as would exist if the image had been added before you branched), svn is totally unable to provide you advice. This is why you will see no merge-left or merge-right files.

The Solution

In the example above the same binary file has been added to both a branch and a trunk. Since the image is identical, the solution was simply to pick one. I picked the working copy.

svn resolve --accept working ./web-app/images/widget.png

Another possible case is that two totally different files have been checked in with the same name and path. In this case, you’re going to need to rename one version and refactor the rest of your code to accommodate that name change. SVN has no easy way to do this so you’ll need to do it manually.

The last case is that the same file has been created but you need a super set of the functionality provided by both versions. Again, SVN does not offer any speedy tools for this so you’ll simply need to do a manual merger.