gpt4 book ai didi

mercurial - Mercurial 如何在内部 merge ?

转载 作者:行者123 更新时间:2023-12-04 21:43:00 24 4
gpt4 key购买 nike

quora 上有一篇关于 git 如何 merge 的漂亮文章:
http://www.quora.com/Git-revision-control/How-does-git-merge-work

我想知道 Mercurial 是否存在这样的事情。

我承认我这样做的动机是 Mercurial 在自动解决冲突方面似乎非常愚蠢,但是没有关于 mercurial 如何 merge 的具体信息,我无法为 Git 提出论据。 (也可能我疯了,方法是一样的,不管我在任何地方都找不到关于 HG 如何 merge 的信息。)

我也听说 HG 是 super 可配置的,所以如果有一种工具可以使 merge 不那么愚蠢,我很想听听。

作为 HG 似乎所做的愚蠢的一个例子,它与其他空值产生了许多冲突,例如:

<<<<<<<< local
[some new code...]
========
>>>>>>>> other

编辑:所以,我也在寻找一种可以智能地自动解决冲突的 merge 工具。就像,它应该能够解决上面的例子,解决起来非常简单。

最佳答案

Mercurial 在很大程度上将 merge 留给了外部程序。看
https://www.mercurial-scm.org/wiki/MergeToolConfiguration

https://www.mercurial-scm.org/repo/hg/help/merge-tools
从最后一页:

Mercurial uses these rules when deciding which merge tool to use:

  1. If a tool has been specified with the --tool option to merge orresolve, it is used. If it is the name of a tool in the merge-toolsconfiguration, its configuration is used. Otherwise the specified toolmust be executable by the shell.

  2. If the "HGMERGE" environment variableis 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 inthe merge-patterns configuration section, the first usable merge toolcorresponding to a matching pattern is used. Here, binary capabilitiesof the merge tool are not considered.

  4. If ui.merge is set it will beconsidered 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 configurationsection, the one with the highest priority is used.

  6. If a program named "hgmerge" can befound on the system, it is used - but it will by default not be usedfor 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.

Note: After selecting a merge program, Mercurial will by default attempt tomerge the files using a simple merge algorithm first. Only if it doesn'tsucceed because of conflicting changes Mercurial will actually execute themerge program. Whether to use the simple merge algorithm first can becontrolled by the premerge setting of the merge tool. Premerge isenabled by default unless the file is binary or a symlink.

关于mercurial - Mercurial 如何在内部 merge ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21637143/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com