Mercurial无法通过命令行进行合并

时间:2013-11-22 11:44:27

标签: command-line merge mercurial

我的mercurial安装拒绝通过命令行合并。这是我打开verbosedebug后的输出。

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!

注意:合并实际上是成功的(kdiff3弹出,我合并并保存),但mercurial很困惑。

如何确定Mercurial无法找到哪个path

我已尝试更新到最新版本(2.8),并查看我的mercurial.ini是否有任何可疑文件。我还使用了不同的合并工具p4merge来达到同样的效果。

1 个答案:

答案 0 :(得分:0)

嗯......实际上。

这可能是愚蠢的“解决方案”,但您可以查看应该附带mercurial的filemerge.py文件。 此文件定义了mercurial如何进行合并(调用外部合并工具,处理结果等)。

您可以在filemerge函数中看到以下几行:

    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))

他们在你的输出中给出了相应的信息:

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

然后从_xmerge函数调用filemerge函数,其中包含以下行:

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

然后ui.warn(onfailure % fd)到达334行或368行(我不知道),这会给出您的上一条错误消息:

merging StackOverflow/StackOverflow.csproj failed!

ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))ui.warn(onfailure % fd)之间的某个地方,有一个原因可以实现ui.warn(onfailure % fd)(可能在_xmerge中)。您可以尝试通过在filemerge.py文件的各个位置插入各种调试输出并重试合并来发现它。这就是我目前所能推荐的(因为我无法在我的机器上重现您的错误和上下文)。


P.S。:正如santiagopim建议的那样,您可能更喜欢将WC复制到干净的墨盒安装并在那里重试。因为错误很可能是由于一些错误配置造成的。但是,如果您希望尝试就地解决问题......