Mercury merger conflict on adjacent lines

I found the following case.

$ hg init
$ echo '
> line 1
> line 2
> ' > file.txt
$ hg add file.txt
$ hg commit -m 'added'
$ echo '
> line 11
> line 2
> ' > file.txt
$ hg commit -m 'changed line 1'
$ hg update 0
$ echo '
> line 1
> line 21
> ' > file.txt
$ hg commit -m 'changed line 2'
$ hg merge 1

Result:

file.txt file merge failed!

hg diff file.txt

diff -r bc62305d407b file.txt
--- a/file.txt  Fri Jun 17 22:53:22 2011 +0300
+++ b/file.txt  Fri Jun 17 22:53:46 2011 +0300
@@ -1,4 +1,9 @@

+<<<<<<< local
line 1
line 21
+=======
+line 11
+line 2
+>>>>>>> other

If we try the scenario described above, but with 3 lines and changes on 1 and 2 lines, the merge will be successful. So my question is, why is this happening? Is this a merge algorithm problem or something else?

+3
source share
1 answer

Mercurial simply cannot merge automatically because the person has to solve the conflict. How Mercurial knows if the contained merge version should contain

line 1
line 21

or

line 11
line 2

Mercurial does not view one side of the merger as an authority that could take precedence. Markers in file.txtis Mercurial tips for you where your hands are needed.

, . .

+2

All Articles