如何检测 Mercurial 历史记录中手动合并了哪些文件?
我是新使用 Mercurial 的团队的一员,我们发现当发生合并时,手动合并的文件中会出现更多错误。是否可以从水银日志(即在有人完成合并并将合并变更集推送到中央存储库之后)来检测哪些文件被手动合并?
I'm part of a team newly using mercurial and we've identified that when merges occur there are many more errors in files that are manually merged. Is it possible from the mercurial logs (i.e. after someone has done the merge and pushed the merge changeset to the central repository) to detect which files were manually merged?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,我不知道这是否万无一失。另外,它需要我尚未完成的 Mercurial .NET 库的副本,可能只能在 Windows 上运行,并且边缘有点粗糙。
注意:我假设“手动合并”的意思是“Mercurial 没有为我们自动合并文件”
这样的文件仍然可以通过外部工具在某种程度上或完全自动合并,但如果上述假设足够好,请继续阅读。
然而,我所做的是有效地运行测试存储库中的所有合并,重新进行合并并要求 Mercurial 仅使用其内部合并工具,如果 Mercurial 无法自动合并文件,则文件将无法解析,然后报告所有未解析的文件,清理合并,然后继续下一个合并变更集。
你需要的库(目前只有源代码形式,我告诉你它还没有完成):
我在底部附加了一个 zip 文件,其中包含所有内容、测试存储库、脚本、和库的二进制副本。
脚本(我使用 LINQPad 来编写和测试它,测试存储库的输出如下):
示例输出:
Zip-包含所有内容的文件(LINQPad 脚本、Mercurial.Net 程序集,如果您不信任我,请编译它,以及我在上面执行它的测试存储库):
大警告:仅在存储库的克隆中运行此文件!如果这损坏了您的存储库,我将不承担任何责任,无论我认为这种情况多么不可能。
Note, that I have no idea if this is foolproof. Also, it requires a copy of my as of yet unfinished Mercurial library for .NET, probably only runs on Windows, and is kinda rough around the edges.
Note: I'm assuming that by "were manually merged", you mean "files Mercurial didn't automatically merge for us"
Such a file could still be merged somewhat or completely automatic by an external tool, but if the above assumption is good enough, read on.
However, what I did was to effectively run through all the merges in a test repository, re-doing the merges and asking Mercurial to use only its internal merge tool, which leaves files unresolved if they cannot be automatically merged by Mercurial, and then report all unresolved files, clean up the merge, and move on to the next merge changeset.
The library you need (only in source code form at the moment, I told you it was unfinished):
I've attached a zip file at the bottom with everything, test repository, script, and binary copy of library.
The script (I used LINQPad to write and test this, output from a test-repository follows):
The sample output:
Zip-file with everything (LINQPad script, Mercurial.Net assembly, go compile it if you don't trust me, and the test repository I executed it against above):
BIG CAVEAT: Run this only in a clone of your repository! I won't be held responsible if this corrupts your repository, however unlikely I think that would be.
这是 Lases 答案:
示例输出:
Tis is the shell script variant of Lasses answer:
Example output: