Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN merge merged extra stuff

Tags:

merge

svn

I just did a merge using something like:

svn merge -r 67212:67213 https://my.svn.repository/trunk .

I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the destination ChangeLog. I noticed there was a conflict when I executed --dry-run, so I updated ChangeLog, and there was still a conflict (and I saw the conflict when I did the actual merge).

I then later diffed on the file I was merging from:

svn diff -r 67212:67213 ChangeLog

And I see just the changes I had made, so I know that extra changes didn't get in there somehow.

This makes me worried that merge is not actually just taking what I changed, which is what I would have expected. Can anybody explain what happened?

UPDATE: In response to NilObject:

So, I have 2 files changed, only ChangeLog is relevant, the other merged fine. When I go to my regular trunk checkout, I do the diff command above and see:

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 67212)
+++ ChangeLog   (revision 67213)
@@ -1,3 +1,7 @@
+2008-08-06  Mike Stone  <myemail>
+
+   * changed_file: Details.
+
 2008-08-06  Someone Else  <their_email>

    * theirChanges: Details.

After my merge of the previous changes, the diff of ChangeLog looks like this:

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 67215)
+++ ChangeLog   (working copy)
@@ -1,3 +1,14 @@
+<<<<<<< .working
+=======
+2008-08-06  Mike Stone  <myemail>
+
+   * changed_file: Details.
+
+2008-08-06  Someone Else  <their_email>
+
+   * theirChanges: Details.
+
+>>>>>>> .merge-right.r67213
 2008-08-05  Someone Else2  <their2_email>

    * olderChange: Details.

Note that the entry that was incorrectly pulled in was not in the file I am merging it to, but yet it was not one of my changes and shouldn't have been merged anyways. It was easy to fix (remove the extra lines that weren't part of my changes), but it still makes me worry about merging automatically in SVN.

like image 234
Mike Stone Avatar asked Aug 06 '08 22:08

Mike Stone


1 Answers

This only happens with conflicts - basically svn tried to merge the change in, but (roughly speaking) saw the change as:

Add

2008-08-06  Mike Stone  <myemail>

* changed_file: Details.

before

2008-08-06  Someone Else  <their_email>

And it couldn't find the Someone Else line while doing the merge, so chucked that bit in for context when putting in the conflict. If it was a non-conflicting merge only the changes you expected would have been applied.

like image 195
Cebjyre Avatar answered Nov 07 '22 23:11

Cebjyre