Search code examples
svnmergetree-conflict

svn - how to merge a directory that was manually created in two branches?


I am facing a issue with svn merging, here is the scenario

Trunk
Branch1
Branch2

A new folder 'abc' was created on Branch1 and Branch2 simulataneously, the code-base of both was updated till Branch1 was released. Further code chagnes were made on Branch2.
Now when, Branch1 was merged back to Trunk, it was smooth.
When Trunk was merged to Branch2, there was a tree conflict ( as expected).

But now I am not sure how to proceed. I want to retain the lcoal changes in Branch2 as well as merge the directories correctly, so that the future merges doesn't give any tree conflict.

Any ideas? have anyone faced such issue? Any resolution?


Some answer to question asked: Q Why did you create two branches at the same time?
A: I am on merging svn task in a team of 25 devs. 2 developers have created this.

Q And, why did both branches create this abc directory?
A: It's same project that is being used. One is working on it's inital phase, while other on a feature of it before it is actaully released.

Q Is abc a project or merely a new directory under an existing project?
A: it's a new project

Did that abc directory exist in the trunk?
A: No


Solution

  • To Subversion /Branch1/abc and /Branch2/abc are two completely separate directories. There's no common history between the two. Next time, you need to use svn cp, so Subversion can tell that they're related.

    You can try the --ignore-ancestory tag, but that will do a two-way merge instead of a three-way merge. That means if I merge /Branch2 into /Branch1, the abc directory on /Branch1 will be whatever was on /Branch2.

    Why did you create two branches at the same time? And, why did both branches create this abc directory? Is abc a project or merely a new directory under an existing project? Did that abc directory exist in the trunk?

    It sounds like you may have to review your CM practices. Unfortunately, without more information, I can't give you more specific advice.