首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >让Mercurial为自己的合并使用自定义的合并工具

让Mercurial为自己的合并使用自定义的合并工具
EN

Stack Overflow用户
提问于 2012-04-10 06:49:14
回答 2查看 1.2K关注 0票数 2

当Mercurial必须进行3路合并时,mercurial文档会做些什么:

默认情况下,Mercurial将尝试在内部对文本文件进行经典的3路合并,然后尝试使用外部工具。

当它调用外部工具时,这总是一个“手动合并”。

并不是所有的合并工具都是平等创建的,正如我选择的合并工具(Araxis )一样,它通常能够自动合并3个文件,而mercurial的内部合并工具无法做到这一点。

这导致了大合并的场景,在这种情况下,可能会有一堆文件干净地合并,这是由hg的内部mergetool完成的,然后其他一些文件可能不会干净地合并,但是如果hg允许我指定它的mergetool,它可能会合并。我发现这使得大合并效率很低,因为你需要大量的上下文切换: hg弹出我的合并工具,我想“噢该死,冲突”,然后实现“哦等等,根本没有冲突”。

我想知道这里是否遗漏了什么,或者是否真的没有办法让hg能够使用自定义的合并工具来自动尝试进行合并。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-04-16 14:15:02

我认为你正在寻找一个开关,以使Araxis合并自动关闭自己,如果它可以自动合并。我看了一下命令行引用和他们的SCM集成文档,但实际上我不确定它会是什么开关。你得自己做实验。

从Mercurial的观点来看,没有所谓的“手动合并”。Mercurial首先尝试内部合并(所谓的“预合并”步骤),如果这一步骤失败,它将寻找外部工具。如果合并工具的退出代码为零(成功退出),则合并仍然可以是全自动。Mercurial将考虑合并成功,然后继续到下一个文件。根据工具的不同,您根本不会注意到这一点: Mercurial只是在后台运行该工具,并且只有在出现严重的合并冲突时才会提示您采取行动。

票数 1
EN

Stack Overflow用户

发布于 2012-04-10 16:01:59

您可以使用自定义合并工具与Mercurial。help merge-tools显示了选择运行工具的顺序:

代码语言:javascript
复制
1. If a tool has been specified with the --tool option to merge or
   resolve, it is used.  If it is the name of a tool in the merge-tools
   configuration, its configuration is used. Otherwise the specified tool
   must be executable by the shell.
2. If the "HGMERGE" environment variable is present, its value is used and
   must be executable by the shell.
3. If the filename of the file to be merged matches any of the patterns in
   the merge-patterns configuration section, the first usable merge tool
   corresponding to a matching pattern is used. Here, binary capabilities
   of the merge tool are not considered.
4. If ui.merge is set it will be considered next. If the value is not the
   name of a configured tool, the specified value is used and must be
   executable by the shell. Otherwise the named tool is used if it is
   usable.
5. If any usable merge tools are present in the merge-tools configuration
   section, the one with the highest priority is used.
6. If a program named "hgmerge" can be found on the system, it is used -
   but it will by default not be used for symlinks and binary files.
7. If the file to be merged is not binary and is not a symlink, then
   "internal:merge" is used.
8. The merge of the file fails and must be resolved before commit.

更多信息可以在help config中找到-查找merge-toolsmerge-patterns

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10084313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档