views:

46

answers:

2

I am doing an SVN merge for a branch, and in one of the files I see this:

GetQueryReferenceData(int sessionId, Int32 sessionId)

Which means that the merge tool just added another parameter without asking any questions. Imagine if it was a call to Substring(0) and in another branch it would be Substring(0,2). That is completely different behavior, how does it even get to decide which one to choose? Good thing it came up during compile time.

The problem is that it will not be marked as a conflict and will be merged automatically. That is very dangerous behavior and if you don't have the luxury of having a unit test for every line of code - you are screwed.

What am I doing wrong and how to do big merges without the merging tool putting in dangerous changes silently? Is there a merge tool that is not language agnostic?

I am using Tortoise SVN.

+1  A: 

So, I am not familiar with the TortoiseSVN interface, but if there is a conflict, the standard subversion commandline utility will notify you of conflicts and allow you to specify which version ("mine", "theirs") you want to use or whether you would prefer to resolve the conflicts manually. Note, though, that if the merge/update involved different sections of code (so that there was no conflict), then it is expected behavior that whatever changes (whether it is a change to the signature or otherwise) will be applied. So, rather than asking why SVN merged the changes you requested, you should ask why your developers chose to change the signature in the changeset (since SVN isn't responsible for the changes that are made in the changeset, only for versioning those changes and for applying those changes in your working directory as requested).

Also, if you want to prevent the other developers for pulling shenanigans and commiting breaking changes to the code, you can create various "hooks" that are run before or after commit to ensure that code compiles or to perform whatever custom validation you would like to do on the code and reject changes accordingly.

Michael Aaron Safyan
Code changes, signature was just an example. When code is changed automatically by the merge tool it scares me, because if there is a conflicting piece of logic that is on different lines it won't be marked as a conflict and will be just merged. That is the problem.
HeavyWave
@HeavyWave, then why are you merging? Perhaps you want to run "svn diff" to see the list of changes before applying them?
Michael Aaron Safyan
If I were to go through every line manually it would take me forever. Maybe there is a merge tool that is not so plain dumb as Tortoise SVN and is not language agnostic.
HeavyWave
If the merge tool "changes code", there is a huge bug in the merge tool. It is not entitled to introduce anything that wasn't in one of the two files it's merging. It's not the merge tool that added a parameter, it's someone who edited one or other of the files.
Colin Fine
+1  A: 

Without asking can mean different things. First you haven't changed that file locally or not in the particular area of the function, cause a conflict could have only occur if you have modified that same line. No tool will point you to this kind of changes. Or may be you used an option --accept ...And of course you should have unit tests to make such a situation safe. An furthermore no version control tool will handle this situation better, cause no version control tool is language dependent. May be it would be a good idea to use an IDE Integration and do the merge inside there, may be the support is better. And of course before committing such thing you can check the merge via an svn diff (Check for modifications).

khmarbaise