How to accept 'theirs-conflict' to resolve tree conflict: Local add, incoming add upon merge

38,041

Solution 1

The right thing to do is detect this problem in a previous --dry-run and delete the local conflicting dir with svn delete before doing the merge.

First scenario: Working copy with the merge already done. Solution: Delete the working copy, checkout a clean copy and do the right thing.

Second scenario: Already commited wrong directory, after svn resolve --accept=working.

You must svn delete the conflicting directory, and rerun the merge from the parent directory of the conflicting directory ignoring mergeinfo. Revert every object except the previous conflicting directory (now there isn't conflict). Check and commit the changes.

Ex. Working copy un WC folder. Your conflict in A/conflictDir directory:

cd A
svn delete conflictDir
svn merge --ignore-ancestry -rbeginRev:endRev <URLrepo/A>
svn -R revert `ls | grep -v conflictDir`
<... check ...>
svn ci -m "conflictDir fixed"

Solution 2

I had similar problem, where I svn update a file which has conflict with my local file. I want the remote copy to replace my local copy. What I did is svn delete file_name, and then svn revert file_name. It recovers to the remote copy. I am not sure if the first svn delete is necessary or not.

Share:
38,041

Related videos on Youtube

Elie Xu
Author by

Elie Xu

I think I need to have some changes.

Updated on October 26, 2020

Comments

  • Elie Xu
    Elie Xu over 3 years

    I have come across the following basic Tree conflict: Local add, incoming add upon merge.

    I know we can use svn resolve --accept working file to resolve it, but SVN prevent me to use accept their-conflict to accept the incoming version.

    Can anyone tell me how to replace my local file by the incoming one? Is it possible using svn resolved file in any way?

    • aroth
      aroth about 12 years
      One option is to move your local file out of the way, do an svn update, put your file back, and then do an svn commit. Granted it's probably not the "correct" way to do it, but it's probably a lot simpler than playing with the SVN commands.
    • Elie Xu
      Elie Xu about 12 years
      @aroth, these files are already existed both in trunk and branch (background: I merge the branch to trunk weekly), in fact, I want to use the one in branch to overwrite the one in trunk, as you said, I need to delete these files in trunk, then commit, then merge them from branch, right?
    • Elie Xu
      Elie Xu almost 12 years
      @malenkiy_scot,No,for some history reasons,I didn't verify whether the steps which I indicated are right or not. The tree conflicts are caused by repeating merge, so I deleted the svn:mergeinfo property of the sub directory, let it inherit it's parent one(the correct one), it works in my situation.
  • tomjen
    tomjen over 7 years
    It was for me, deleting the file just with rm caused the conflict to remain, but deleting it with svn delete and then restored it fixed the tree conflict.
  • John
    John almost 5 years
    These conflicts also occur on incoming delete. Then svn revert DIR will delete the directory and the conflict is gone.