2

Joel's tutorial has a nice example where a kdiff3 GUI window pops up, with 4 partitions to help you resolve a merge conflict.

Question 1:In my newly Solaris 10 installation, there is no GUI (no hgtk or kdiff3 equivalent). Where can I get it?

Question 2: in my Windows/Cygwin installation, I don't know how to set it up. I set "export HGMERGE=merge", and upon conflict, hg merge exits with a return code = 1. But no GUI.

Question 3: once that 'hg merge' is executed, it is in an un-resolved state. How do I completely back out (back to before hg merge was executed)?

Question 4: what does "hg resolve" do? in my example, I have 2 different changes to the same line. It did not resolve anything:

$ hg resolve recipe
merging recipe
The system cannot find the path specified.
merging recipe failed!
flag

1 Answer

3

Answer 1

You can get kdiff3 from their sourceforge page: http://kdiff3.sourceforge.net/

Answer 2

To set up kdiff3 as your merge tool, open your ~/Mercurial.ini (or ~/.hgrc for *nix) file and add the following:

First, add a [merge-tools] section:

[merge-tools]
kdiff3.executable=/path/to/kdiff3
kdiff3.premerge=True
kdiff3.binary=False

Then, under the [ui] section add merge=kdiff3.

Answer 3

You can undo a merge by running hg update -C which will undo the merge and unset the "currently merging" flag.

Answer 4

For the most part, hg resolve just helps you tell Mercurial which of the files are resolved and which are not, so it knows when the merge is finished when there is a failed merge. The use case is something like this:

$ hg merge
...
merge failed
...
$ hg resolve --list           # You can also use -l
U foo.txt                     # Conflicts in foo.txt are Unresolved
$ hg resolve --mark foo.txt   # You can also use -m
$ hg resolve -l
R foo.txt                     # Conflicts in foo.txt are Resolved
$ hg commit -m Merge          # Everything is resolved, I can commit the merge

You can also redo a merge using hg resolve --all, which will start everything over from scratch.

link|flag
about #2: setting up for kdiff3. I did everything but still does not popup kdiff3. with HGMERGE=merge, it exits with return code 1. After I unset HGMERGE, it exits with return code 0, of course after spitting the usual error/warnings PS: I modified (Cygwin) ~/.hgrc not Mercurial.ini/.hgrc. Does that make a difference? – Suu Quan May 5 2010 at 19:51
1 
kdiff3-merge on Windows: I got it now. What is missing is "export HGMERGE=kdiff3" – Suu Quan May 5 2010 at 22:00

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.