Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging with MercurialEclipse has conflicts that are resolved automatically when merged at the command line

I am playing around with Mercurial to see if it is suitable for use in our company. One of the big selling points of it is the merging capabilities. So I have been playing around with creating branches and merging them back into the default line. The tested involved simply adding a new method (methodA) to a single Java file in one branch, and adding a different method (methodB) in a completely different place in the same file in another branch.

When I first tried it in Eclipse using the team-> merge option I found that the first merge worked fine (i.e. it added method A). When I try to merge the second branch now it tells me there is a conflict that I must resolve. This is very unfortunate as I thought this simple kind of merge was exactly the kind of thing Mercurial was supposed to handle with ease?

I tried the exact same test using the command line, and this time it worked fine, i.e. both of the merges were successful with no need to resolve conflicts. Looking at the console output in eclipse it is using the following command to perform the merge:

hg -y merge --config ui.merge=internal:fail -r 611ca2784593525cdafd3082b17d3310037a5d58 -f

whereas when I run it myself from the command line I simply do:

hg merge -r 1234

Is the use of the merge strategy 'internal:fail' causing this to happen within Eclipse?? And if so is it possible to change the default behaviour so that it works the same way as it does at the command line?

like image 874
DaveJohnston Avatar asked Jan 10 '11 12:01

DaveJohnston


People also ask

What is a merge conflict?

A merge conflict is an event that occurs when Git is unable to automatically resolve differences in code between two commits. When all the changes in the code occur on different lines or in different files, Git will successfully merge commits without your help.


1 Answers

The internal:fail tells Mercurial to not to try merge anything at all. See the mercurial wiki for more details.

It seems whomever wrote the Eclipse plugin for mercurial felt they could better control the merge in eclipse by having Mercurial automatically fail to merge everything and then to do the merge in Eclipse, and presumably call hg resolve --mark ... as files are merged.

From the Mercurial command line you're getting both the premerge behavior which handles trivial merges, and then if there are still conflicts the invocation of tool from your MergeToolConfiguration that has the highest priority for that file type and is available on your local system.

like image 94
Ry4an Brase Avatar answered Oct 19 '22 23:10

Ry4an Brase