Merge tool capable of merging conflicting changes

491 views Asked by At

I'm currently using TortoiseSVN to do a merge of two branches and I've found that its not smart enough to handle a specific merging senario.

In one branch I have a method as follows:

MyMethod(parameter1, parameter2, parameter3)

In the other branch I have the same method as follows:

MyMethod(parameter1, parameter2, parameter4)

TortoiseMerge notices that there is a conflict but only gives me the option of using one method signature or the other. However, what I really want is to merge it into a single method with all four parameters as follows:

MyMethod(parameter1, parameter2, parameter3, parameter4)

The only way I can get around this conflict at the moment is to resolve the line so that both methods are present and then manually go to the file and correct it after the conflict has been resolved.

Is this just the way things are or is there a smarter merge tool out there somewhere that would be able to handle this scenario?

5

There are 5 answers

2
si618 On BEST ANSWER

I don't get it? Your project won't compile, or worse, won't run correctly after the merge because the method signature you want is not in either branch. Isn't this more dangerous than a conflict? Perhaps I've missed something obvious.

IMHO TortoiseSVN (or rather the SVN client) is doing the right thing in reporting a conflict, it needs human intervention.

0
popester On

Araxis Merge is popular for its power. Personally I like SourceGear DiffMerge since its more free'er.

0
ccalboni On

I'm sure TortoiseSVN can't handle this. More broadly, any other text based merge/diff tool can't: keep in mind that those tools are agnostic of language you're using, they don't understand your code semantically. They just make a "char by char" comparison, without actually reading like a compiler do or giving a meaning to what those chars are expressing.

In case you're using a language in which this kind of operation is somewhat legal, maybe you can check if there's something related to that language.

As for the ability to edit while merging, TortoiseSVN can actually do that.

0
Naga Kiran On

AFAIK, No merge tool can help in these scenarios except reporting it as conflict

You want the tool to merge it into a single function call with all 4 parameters.

MyMethod(parameter1, parameter2, parameter3, parameter4)

Here also comes the ambiguity whether to place the parameter3 first and then parameter 4 or the vice-versa.

0
mezoid On

So far I haven't found any tool that does what I'm asking for automatically. It may not even be possible. But I have found a workaround which I thought I'd report on.

I ended up installing perforce visual merge which I've found has a nicer merge facility than the default provided by tortoise svn. One of the nice features I've found, which I can't remember if tortoise merge had, is that it allows one to see and edit the merged result. So even though it can't automatically merge the line I want, I am able to edit the conflict in situ instead of resolving it incorrectly and manually updating it after the merge.