Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TortoiseSVN Tree Conflict: can't choose remote file

Here's the scenario:

  • User1, Branch1: adds "abc.def"; commits.
  • User2, Branch2: adds "abc.def" (same file name, but more details in the file); commits.

Now User1 wants to merge the updated version of the "abc.def" file. So (using TortoiseSVN 1.7.10), User1 starts in the Working Copy of Branch1, selects Merge... -> Reintegrate a Branch, then chooses Branch2 and selects Merge. Predictably, a "Tree Conflict" results, with this text:

The last merge operation tried to add the file 'abc.def' from Branch2, but the file was already added locally. How do you want to resolve this conflict?

But the only choice is a single button labelled Keep the local file. There is no option to choose the remote file, which is the one that User1 really wants.

enter image description here

What am I doing wrong here, and how do I fix it? More specifically, how do I get User2's version of the file into Branch1?

(Of course, I'm sure User1 could manually delete the file prior to merging, but that obliterates any history that User1 may have wanted to preserve. Plus it's just a clunky workflow, particularly when there are numerous files in this predicament.)

Unfortunately, this scenario isn't even mentioned in the TortoiseSVN documentation on Tree Conflicts

UPDATE:

In addition to choosing "Reintegrate a Branch" I have also tried "Merge a Range of Revisions" and "Merge two different trees". For the latter case, I chose the remote branch (Branch2) as the "Start" and the local branch as the target (Branch1; choosing the Revision prior to the addition of the file.) I got the same result in all cases: Tree Conflict with no option to select the User2 version of the file.

UPDATE #2:

According to the documentation, there should be "a checkbox in the merge progress dialog called Merge non-interactive", which, if unchecked, supposedly opens the "Merge Conflict Callback Dialog" during the Merge. However, I cannot find any such checkbox in the merge process. Where is it?

like image 387
kmote Avatar asked May 22 '17 16:05

kmote


People also ask

How do I stop tree conflict in SVN?

When you merge your branch back into the trunk, SVN tries to do the same again: It sees that a file was created in your branch, and tries to create it in your trunk in the merge commit, but it already exists! This creates a tree conflict. The way to avoid this, is to do a special merge, a reintegration.

What causes SVN conflicts?

Since 1.6 version SVN recognizes a new kind of conflict, known as a "tree conflict". Such conflicts manifest at the level of directory structure, rather than file content. Situations now flagged as conflicts include deletions of locally modified files, and incoming edits to locally deleted files.

What is a tree conflict SVN?

A tree conflict is a conflict at the folder level and occurs when the user runs an update action on a file but the file does not exist in the repository anymore because other user renamed the file, moved the file to other folder or deleted the file from repository.


1 Answers

I was able to merge from one branch to another in version 1.9 of TortoiseSVN with the following procedure.

Setup

With a test repository, I did the following steps:

  1. Create a branch, "first"

  2. Create a file "doc.txt" with contents "FIRST" in the new branch first doc

  3. Add and commit the file to the new branch

  4. Create a branch, "second"

  5. Create a file "doc.txt" with contents "SECOND" in that branch second doc

  6. Add and commit the file to the new branch

So my structure looks like:

branches/
    first/
        doc.txt => "FIRST"
    second/
        doc.txt => "SECOND"

Merging

In this example, my goal is to get the contents of second/doc.txt into the first branch.

  1. Right-click on the first branch folder, and select TortoiseSVN > Merge...

  2. Select "Merge two different trees"
    merge dialog

  3. Fill in the "From" box with the URL for /branches/first, and the "To" box with the URL for /branches/second.
    enter image description here
    (This is where I got tripped up originally - I thought it would be the opposite! The docs explain: "This may sound wrong, but remember that the trunk is the start point to which you want to add the branch changes.")

  4. Hit Next and try a test merge if you want. It should show that "doc.txt" is replaced, with no tree conflicts. For this example the default merge options were fine.
    merge options

  5. Do the merge and check the contents of first/doc.txt - it should now read "SECOND".
    merge results

  6. Run an update and then commit the first folder to save the merge to the repository!
    commit results

Complete log:
repository log

like image 140
user812786 Avatar answered Oct 28 '22 10:10

user812786