psihodelia
psihodelia

Reputation: 30512

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

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?

Upvotes: 107

Views: 53939

Answers (2)

djc
djc

Reputation: 11731

Try this:

hg merge --tool internal:other

See also hg help merge-tools for more information.

Upvotes: 28

Noffls
Noffls

Reputation: 5427

Use

hg resolve -t internal:other --all

to accept theirs and

hg resolve -t internal:local --all

to accept yours

Upvotes: 189

Related Questions