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

merge situation where line is duplicated - a bug?

From: Trent Cobham <trent_at_warsheep.org>
Date: 2006-10-11 18:33:45 CEST

I have a particular merge situation (below) where an identical line
added to a file on both trunk and branch appears twice in the file
after merging branch into trunk.

If I replicate the situation with either gnu patch (2.5.4) or
CVS (1.11) both generate a conflict, and from reading the redbook section
'Tracking Merges Manually', I would have expected a conflict in svn.

I understand that applying a change twice may be something of a roll
of the dice, but I think this is probably a bug as it isn't consistent
with other closely similar situations in svn described below - anyone
agree?

Specifically, if I have an identical file on trunk & branch, then:

1. On both trunk & branch: add (the same) line to the file.
2. (KEY STEP) On branch only: modify the line above the added line
3. Merge the branch changes into trunk.

Then the merged output comes out as:

modified line
added line
added line

(ie the added line appears twice in the result). This happens in 1.3 &
1.4.

If instead on step 2 I modify the line _below_ the added line instead of
above it, I get a conflict, as I'd expect.

If instead on step 2 I modify the line 2 lines above the added line,
then the added line only appears once, which is fine.

If I omit step 2, then the merge doesn't change the file (ie the
added line appears once), again as expected.

So adding the line twice looks unintentional to me.

I've tested this with a test file - 13 lines 'aaa' to 'mmm':

the 'trunk' adds a line (XXX)

@@ -5,6 +5,7 @@
   eee
   fff
   ggg
  +XXX
   hhh
   iii
   jjj

the 'branch' adds the same line (XXX), and changes the line above it
(ggg becomes GGG):

@@ -4,7 +4,8 @@
   ddd
   eee
   fff
  -ggg
  +GGG
  +XXX
   hhh
   iii
   jjj

After merging branch onto trunk, with svn 1.3 or 1.4, I get:

eee
fff
GGG
XXX
XXX
hhh
iii

ie two copies of XXX.

When I try it with the gnu patch command (and a unified diff),
I get a conflict:

***************
*** 4,10 ****
    ddd
    eee
    fff
  - ggg
    hhh
    iii
    jjj
--- 4,11 ----
    ddd
    eee
    fff
  + GGG
  + XXX
    hhh
    iii
    jjj

When I try the same in CVS, I get a conflict.

eee
fff
<<<<<<< test.txt
ggg
XXX
=======
GGG
XXX
>>>>>>> 1.1.2.1
hhh
iii

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Oct 11 18:34:48 2006

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.