与 MercurialEclipse 合并存在冲突,在命令行合并时会自动解决这些冲突
我正在尝试 Mercurial,看看它是否适合在我们公司使用。它的一大卖点是合并功能。所以我一直在尝试创建分支并将它们合并回默认行。测试涉及简单地将新方法 (methodA) 添加到一个分支中的单个 Java 文件中,并在另一个分支中的同一文件中完全不同的位置添加不同的方法 (methodB)。
当我第一次使用团队在 Eclipse 中尝试时->合并选项 我发现第一个合并工作正常(即它添加了方法 A)。当我现在尝试合并第二个分支时,它告诉我存在必须解决的冲突。这是非常不幸的,因为我认为这种简单的合并正是 Mercurial 应该轻松处理的事情?
我使用命令行尝试了完全相同的测试,这次效果很好,即两次合并都成功,无需解决冲突。查看 Eclipse 中的控制台输出,它使用以下命令来执行合并:
hg -y merge --config ui.merge=internal:fail -r 611ca2784593525cdafd3082b17d3310037a5d58 -f
而当我自己从命令行运行它时,我只是做:
hg merge -r 1234
使用合并策略“internal:fail”是否导致这种情况在 Eclipse 中发生??如果是这样,是否可以更改默认行为,使其工作方式与在命令行中的工作方式相同?
I am playing around with Mercurial to see if it is suitable for use in our company. One of the big selling points of it is the merging capabilities. So I have been playing around with creating branches and merging them back into the default line. The tested involved simply adding a new method (methodA) to a single Java file in one branch, and adding a different method (methodB) in a completely different place in the same file in another branch.
When I first tried it in Eclipse using the team-> merge option I found that the first merge worked fine (i.e. it added method A). When I try to merge the second branch now it tells me there is a conflict that I must resolve. This is very unfortunate as I thought this simple kind of merge was exactly the kind of thing Mercurial was supposed to handle with ease?
I tried the exact same test using the command line, and this time it worked fine, i.e. both of the merges were successful with no need to resolve conflicts. Looking at the console output in eclipse it is using the following command to perform the merge:
hg -y merge --config ui.merge=internal:fail -r 611ca2784593525cdafd3082b17d3310037a5d58 -f
whereas when I run it myself from the command line I simply do:
hg merge -r 1234
Is the use of the merge strategy 'internal:fail' causing this to happen within Eclipse?? And if so is it possible to change the default behaviour so that it works the same way as it does at the command line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
internal:fail
告诉 Mercurial 不要尝试合并任何内容。有关更多详细信息,请参阅mercurial wiki。似乎为 Mercurial 编写 Eclipse 插件的人都觉得他们可以通过让 Mercurial 自动失败合并所有内容然后在 Eclipse 中进行合并来更好地控制 Eclipse 中的合并,并且可能调用 hg resolve --mark ...< /code> 文件被合并。
从 Mercurial 命令行,您可以获得处理琐碎合并的
premerge
行为,然后如果仍然存在冲突,则从 MergeToolConfiguration 对该文件类型具有最高优先级,并且可在本地系统上使用。The
internal:fail
tells Mercurial to not to try merge anything at all. See the mercurial wiki for more details.It seems whomever wrote the Eclipse plugin for mercurial felt they could better control the merge in eclipse by having Mercurial automatically fail to merge everything and then to do the merge in Eclipse, and presumably call
hg resolve --mark ...
as files are merged.From the Mercurial command line you're getting both the
premerge
behavior which handles trivial merges, and then if there are still conflicts the invocation of tool from your MergeToolConfiguration that has the highest priority for that file type and is available on your local system.