Resolving conflicts: how to accept "their" changes automatically?

Mercurial

Mercurial Problem Overview


When merging conflicting changes using hg merge, Mercurial inserts a set of markers into the files to be merged in my working copy like this:

<<<<<<< local
  version = 0.2
=======
  version = 0.1
>>>>>>> other

Then I manually edit all files marked as U from a list produced by hg resolve --all -l and then I tell mercurial I have resolved them by hg resolve -m file1 file2 file3 ...

In many situations I would like however accept either my-only or their-only changes on some conflicting files. I am thinking to create two simple sed/awk/whatever scripts named accept-theirs.sh and accept-my.sh or is there any "proper" way to do it?

Mercurial Solutions


Solution 1 - Mercurial

Use

hg resolve -t internal:other --all

to accept theirs and

hg resolve -t internal:local --all

to accept yours

Solution 2 - Mercurial

Try this:

hg merge --tool 'internal:other'

See also hg help merge-tools for more information.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpsihodeliaView Question on Stackoverflow
Solution 1 - MercurialNofflsView Answer on Stackoverflow
Solution 2 - MercurialdjcView Answer on Stackoverflow