tags:

views:

472

answers:

2

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.

A: 

There's not really enough information to go on here.

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

will merge any files changed in the revision 67212 in the folder /trunk on the repository and merge them into your current working directory. If you do:

svn log -r 67212

What files does it show changed? Merge will only pull changes from the first argument, and apply them to the second. It does not upload back to the server in the first argument.

If this doesn't answer your question, could you post more details as to what exactly is happening?

NilObject
+2  A: 

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.

Cebjyre
I understand why this is the way it is (when doing a visual/manual merge SVN has to provide an "Existing" basis document for the "theirs" side, so the latest revision in your merge criteria is it), but it is really nasty! (at least for someone new to the Merge game and marvelling at the wonder of cherrypickings and other merge goodness)
Tao