RE: how to avoid text and tree conflict
From: Bob Archer <Bob.Archer_at_amsi.com>
Date: Mon, 4 Apr 2011 14:10:11 -0400
> On Mon, 2011-04-04 at 10:26 -0400, Bob Archer wrote:
...in the node1 branch you modified line2 making it read "line2".
...in the node2 branch you modified line2 making it "" and line 3 making it "line3"
When you try to bring these together svn is going to look at the base (r1) of each file. It is going to see that line2 is different from base in both the merge target and the merge source. It also sees that those changes are different. That is a conflict. svn doesn't know whether to use the "line2" content from node1 branch or the "" content from node2.
It may seem obvious to you that you don't want the blank like and you want it to say "line2"... but svn has no way to know this. Perhaps the blank line is what you want in the result.
BTW: This happens even in normal use... since an update it also essentially a merge.
Let's assume we have a file call it test.txt in a repository with the following lines:
We each have it checked out to our working copies.
I make a change to the file so it looks like this, and check it in:
(I have blanked line2, well really it contains a line feed).
You make a change to the file so it looks like this:
You try to commit and you get an error that it is out of date. So you do an update. svn sees that you changed line2 as did the latest HEAD version be comparing them to the common base. This is a conflict... a person has to resolve it. svn can just assume, oh a line with text is more important (or correct) than a line with just a line feed. And if it did do this you would not be very happy.
That all said, we have found in our day to day use of svn we rarely see conflicts like this.
Of course, the above is different than tree conflicts which occur for path change reasons rather than file content reasons.
This is an archived mail posted to the Subversion Users mailing list.