merge-tool "internal:other", I don't quite get it

Giovanni Gherdovich g.gherdovich at gmail.com
Thu Dec 26 17:20:08 UTC 2013


Hello,

I am confused about the semantics of the command

`hg merge --tool=internal:other`

>From `hg help mergetools`

::::
:::: "internal:other"
::::  Uses the other version of files as the merged version.
::::

and I also read the little gotcha at
http://mercurial.selenic.com/wiki/TipsAndTricks#Keep_.22My.22_or_.22Their.22_files_when_doing_a_merge

After these readings my understanding is:
the internal:other merge tool selects changes from "other" __in case of
conflict__.
If there is no conflict for a given line, it takes the change from
whatever head is appropriate.

As in this snippet:

=========================================
$ hg init
$ echo foo > edit_by_me ; echo foo > edit_by_you ; echo foo > edit_by_us
$ hg add * ; hg commit -m foo

$ # I now play as "you"
$ echo 'this is you' > edit_by_you ; echo 'this is you' > edit_by_us
$ hg commit -m foo
$ hg up 0

$ # I now play as "me"
$ echo 'this is me' > edit_by_me ; echo 'this is me' > edit_by_us
$ hg commit -m foo

# the "internal:other" merge tool select "other"
# only in case of conflict. In case of no conflict,
# it does the obvious choice, whatever it is
# (might be "local", might be "other").

$ hg merge --tool=internal:other
$ ls -1
edit_by_me
edit_by_us
edit_by_you
$ cat *
this is me
this is you
this is you
=========================================

But what if the changes are in the same file?
Look and WAT:

=========================================
$ hg init

$ cat<<'EOF' > file
> line 1
> line 2
> line 3
> EOF
$ hg add file ; hg commit -m foo

$ cat<<'EOF' > file
> line 1 -> my change with conflict
> line 2 -> my change without conflict
> line 3
> EOF
$ hg commit -m foo

$ hg up 0
$ cat<<'EOF' > file
> line 1 --> thier change with conflict
> line 2
> line 3 --> their change without conflict
> EOF
$ hg commit -m foo

$ hg up 1
$ cat *
line 1 -> my change with conflict
line 2 -> my change without conflict
line 3

$ hg merge --tool=internal:other
$ cat file
line 1 --> thier change with conflict
line 2
line 3 --> their change without conflict
=========================================

I'd have expected the second line to read
"line 2 -> my change without conflict",
if my interpretation of the command above is correct,
i.e. "if conflict pick other, if no conflict merge as usual".

Looks like in presence of a conflict, wherever in a file,
then the whole file will be taken from "other",
and not only the conflicting changes.

Can anybody clarify this please?
Is it the intended behaviour?

Cheers,
GGhh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20131226/9b0474cf/attachment-0002.html>


More information about the Mercurial mailing list