views:

3219

answers:

3

I have a merging conflict, using Mercurial 1.0.2:

merging test.h
warning: conflicts during merge.
merging test.h failed!
6 files updated, 0 files merged, 0 files removed, 1 files unresolved
There are unresolved merges, you can redo the full merge using:
  hg update -C 19
  hg merge 18

I can't figure out how to resolve this. Google search results instruct to use:

hg resolve

but for some reason my Mercurial (v1.0.2) doesn't have a resolve command:

hg: unknown command 'resolve'

How can I resolve this conflict?

+4  A: 

There is no need to call any hg commands. Unlike svn, Mercurial does not track conflicted files. If you call hg status, you'll see that the file is simply marked as modified.

Just fix the file by hand and commit.

avakar
So it looks like Mercurial moved my local copy to test.h.orig and test.h is now from the other head... is there any way to prevent creation of the .orig file so it doesn't get added accidentally?
lajos
I'm not sure it's possible, but you can add *.orig to your .hgignore file.
avakar
If you simply edit the file and then commit, its possible that it wont be recognized as a merge of the two branches, merely a new commit on your working one.I think you have to fix the file by hand and then do **hg resolve -m test.h** to mark the file as merged.
Nick
The second parent is automatically added to the working directory even when 'hg merge' fails to resolve some conflicted files.
avakar
*Note* This answer is for hg pre 1.1.
Nick
+4  A: 

Tracking conflicts was introduced in Mercurial 1.1, which is a newer version that you are using (you should really upgrade, Mercurial 1.1. was released in December 2008). In that version you gained the resolve command which works similarly to svn resolve.

As I remember it, Mercurial would leave merge markers (the <<<< and >>>> lines) in your file when there is a conflict, unless you have configured a merge tool. This also applies to newer versions -- I have no merge tool configured and get the merge markers when conflicts occur. I can then manually fix the file and mark it resolved with hg resolve.

Martin Geisler
+9  A: 

To highlight an answer in a comment for Hg 1.1+:

For Hg 1.1+ fix the file by hand and then do

hg resolve -m test.h

to mark the file as merged.

David Sykes