运行“hg update”后->找不到合并 MyClass.class 的工具:保留 (l)ocal 还是采取 (o)ther?
我通过执行以下操作返回查看较早的修订版:
hg update -r 10
然后,我想通过执行以下操作返回提示:
hg update
但我收到此消息,并且不知道如何回应它:
tool kdiff3 can't handle binary
tool tortoisemerge can't handle binary
tool winmergeu can't handle binary
tool docdiff can't handle binary
no tool found to merge target/classes/com/mypackage/MyClass.class
keep (l)ocal or take (o)ther?
I went back to take a look at an earlier revision by doing:
hg update -r 10
Then, I wanted to go back to the tip by doing:
hg update
But I got this message and am not sure how to respond to it:
tool kdiff3 can't handle binary
tool tortoisemerge can't handle binary
tool winmergeu can't handle binary
tool docdiff can't handle binary
no tool found to merge target/classes/com/mypackage/MyClass.class
keep (l)ocal or take (o)ther?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的主要问题是您的存储库中有
.class
文件。这些是二进制的,并且 Mercurial 认为您已经更改了它,几乎可以肯定是您的存储库中也有编译代码的结果。
如果这些文件被视为“来自外部源”(例如您下载的库或其他文件并希望与源代码一起保存),则将二进制文件保留在存储库中是可以的。
但是,在存储库中编译源代码的输出不应保留在存储库中,因为这会导致像现在这样的问题。
它基本上是告诉您,更新到旧版本后,该特定文件已更改,因此它不再与旧版本存储库中的文件相同。
然后它会询问您是否要保留修改后的副本,或者更新到存储库中的新副本。这里的“本地”表示“旧存储库版本的修改版本”,“其他”表示“存储库中的新版本”。
在这种情况下,我会为其他人回答
O
,但我也会尝试从存储库中完全删除这些 .class 文件。发生这种情况的一个示例可能是您遇到以下情况(请注意,我不是 Java 开发人员,因此我可能会得到错误的 Java 确切详细信息):
修订版 1,您提交:
版本 2,您提交:
然后更新回修订版 1:
然后编译:
然后您尝试更新备份修订版 2:
这是一个批处理文件(适用于 Windows),它将重现您的情况:
输出:
The main problem here is that you have
.class
files in your repository.These are binary, and seeing as Mercurial thinks that you've changed it, almost certainly the result of compiling code you also have in your repository.
Keeping binary files in the repository is fine if those files are considered "from external sources", like libraries or whatnot that you download and want to keep alongside the source code.
However, the output of compiling source code in the repository should not be kept in the repository, since this will lead to problems like you have now.
It is basically telling you that after you updated to an older version, that particular file has changed, so it is no longer identical to the file you had in your repository for that older version.
And then it asks you whether you want to keep the modified copy, or update to the new one you have in the repository. "Local" here means "modified version from the old repository version", and "other" means "new version in the repository."
I would answer
O
for other in this case, but I would also try to get rid of those .class files from the repository altogether.An example of why this happens can be that you have the following scenario (note that I'm no Java developer so I might get the exact details for Java wrong):
Revision 1, you commit:
Revision 2, you commit:
Then you update back to revision 1:
Then you compile:
Then you try to update back up to revision 2:
Here's a batch file (for Windows) that will reproduce your case:
Output: