[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: merge disagrees with diff

From: Andreas Krey <a.krey_at_gmx.de>
Date: Fri, 28 Oct 2011 14:00:22 +0200

On Fri, 28 Oct 2011 13:02:05 +0000, Flemming Frandsen wrote:
...
> The problem is that there are many more changes in the conflicted
> block than the diff suggested, iow: svn merge tried to add more lines
> than svn diff said it would.

That only looks like that because of the way merging is described in the
book. It is true that if you merge the change from A to B into C and
get D, then diff(A,B) should be the same as diff(C,D). But this holds
only when there are no conflicts.

Example. A is:

  one
  two
  three
  four
  five
  six
  seven

Add a line to get B:

  one
  two
  three
  three two thirds
  four
  five
  six
  seven

Meanwhile for C we have removed a few lines:

  one
  two
  three
  six
  seven

And now we merge the diff(A,B) onto C and get:

  one
  two
  three
  <<<<<<< HEAD
  =======
  three two thirds
  four
  five
>>>>>>> work
  six
  seven

which means it looks like the merge is bringing in 'too much', but what
it is actually showing is that between the lines 'three' and 'seven'
that were in the baseline version of the file (A) there are no lines
left in C and three lines, partially 'new', in B.

In essence, svn sees only two different (and conflicting) changes to
a block of lines, and leaves it to you to deal with that. (Likewise
do git and CVS.)

This looks pretty much like your situation.

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Received on 2011-10-28 14:00:57 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.