7

My mercurial installation refuses to merge via command line. Here's the output after I turn on verbose and debug.

C:\src\StackOverflow>hg resolve --all --verbose --debug
couldn't find merge tool codecompare_diff
couldn't find merge tool codecompare_merge
couldn't find merge tool bcompare
couldn't find merge tool beyondcompare3
couldn't find merge tool beyondcompare3-noauto
couldn't find merge tool rekisa
couldn't find merge tool UltraCompare
couldn't find merge tool araxis
couldn't find merge tool meld
couldn't find merge tool diffuse
picked tool 'kdiff3' for StackOverflow/StackOverflow.csproj (binary False symlink False)
merging StackOverflow/StackOverflow.csproj
my StackOverflow/StackOverflow.csproj@4f4faeac0fea+ other StackOverflow/StackOverflow.csproj@ae29e8c6bb88 ancestor StackOverflow/StackOverflow.csproj@399376fedfc5
The system cannot find the path specified.
merging StackOverflow/StackOverflow.csproj failed!

Note: the merge was actually successful (kdiff3 pops up, I merge and save), but mercurial is confused.

How do I determine which path cannot be found by Mercurial?

I've tried updating to the latest version (2.8) and looking at my mercurial.ini for any suspicious files. I've also used a different merge tool, p4merge, to the same exact effect.

Sklivvz
  • 30,601
  • 24
  • 116
  • 172
  • 1
    Maybe you should migrate it to [meta] because it's about SO? – Johannes Kuhn Nov 22 '13 at 17:58
  • 1
    It's not about SO: it's about Mercurial. The project I'm checking out is called StackOverflow, but that's irrelevant in the context :-) – Sklivvz Nov 22 '13 at 18:06
  • Have you tried it in a `clone` from a fresh box ? Seems a 'system' problem, not Mercurial. – santiagopim Nov 22 '13 at 19:35
  • @san it's clearly a configuration problem of hg, and I'd like to fix it... – Sklivvz Nov 23 '13 at 16:37
  • How can you say for sure that it's "clearly" a configuration problem? Have you tried going up one level to `C:\src`, run `hg clone StackOverflow StackOverflow_clone`, and then going into the cloned directory and do a `hg merge` again? There _might_ be a small chance that something has become corrupted in the original folder, so it's at at least worth a chance to try a clean approach. – Julian Nov 25 '13 at 12:10
  • 2
    Check ini-files (global and repository's) for merge definition in `[ui]` section - it seems you have none specified – Lazy Badger Nov 25 '13 at 12:49
  • 2
    "The system cannot find the path specified." is a message that is coming from Windows, not from Mercurial. Is your kdiff3 tool installed in a directory with spaces in the name? Or perhaps some tool that kdiff3 calls? And maybe somewhere there's an environment variable that is set up without "" or something? Or perhaps there's an environment variable pointing to a directory or file that doesn't exist. As @LazyBadger suggests, check your .ini files, but with an eye toward paths that may not be correct. – shoover Dec 18 '13 at 22:27
  • @shoo I've checked all ini files. I've even stepped through the debugger (without successs), and as i said, the merge is (effectively) successful. The error is independent of the merge tool (which starts successfully with the right files, and changing the tool doesn't alter the message). – Sklivvz Dec 18 '13 at 22:33
  • @shoover actually, if you read the output, it does find the kdiff3 merge tool. Clearly, all the others are not installed (or configured) and so those errors are valid. The error is with the cmd.exe not being able to handle the paths to the diffs. – iheanyi Jan 24 '14 at 16:48

1 Answers1

0

Hmm... Actually.

It may be stupid "solution", but you may look into the filemerge.py file that should come with mercurial. This file defines how mercurial is doing merge (calling external merge-tools, processing result, etc).

Here you see the following lines inside the filemerge function:

    ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
               (tool, fd, binary, symlink))
    [...]
        ui.status(_("merging %s\n") % fd)

    ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))

They are giving correspondent messages in your output:

picked tool 'kdiff3' for StackOverflow/StackOverflow.csproj (binary False symlink False)
merging StackOverflow/StackOverflow.csproj
my StackOverflow/StackOverflow.csproj@4f4faeac0fea+ other StackOverflow/StackOverflow.csproj@ae29e8c6bb88 ancestor StackOverflow/StackOverflow.csproj@399376fedfc5

Then _xmerge function is called from filemerge function with the following lines:

  needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
                       (a, b, c, back))

And then the ui.warn(onfailure % fd) is reached either at line 334 or at line 368 (I don't know), which gives your last error message:

merging StackOverflow/StackOverflow.csproj failed!

Somewhere between ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) and ui.warn(onfailure % fd) there is a reason why ui.warn(onfailure % fd) is actually reached (maybe in _xmerge). You can try to discover it by inserting various debug output in various places of filemerge.py file, and retrying merge. That's all I can currently recommend (as I can't reproduce your errors and context on my machine).


P.S.: As santiagopim suggests, you may prefer to copy WC to the clean PC with clean mercurial installation and retry there. As the errors are most probably caused by some misconfiguration. However, if you prefer to try to resolve problem in-place...

Sasha
  • 3,599
  • 1
  • 31
  • 52