开发者

SVN merge adding parameters. WTF? Or how to do big merges?

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 an开发者_运维问答y 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.


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.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜