Aar*_*sen 2 xml merge mercurial binaryfiles beyondcompare3
我们的Mercurial存储库中有一堆XML文件.当我们将这些文件中的更改从一个分支合并到另一个分支时,Mercurial会抱怨我们的某些XML文件是二进制文件,并要求我在文件的本地版本和其他版本之间进行选择.
我发现Mercurial认为任何带有NULL字节的文件都是二进制文件,而我们的一些XML文件编码为UTF-16,所以包含很多NULL字节. 我的默认合并工具是Beyond Compare,它可以处理UTF-16编码的文件.我在Beyond Compare网站上按照推荐配置了Mercurial ,但在合并期间,Mercurial说:
工具bcomp无法处理二进制文件
是什么赋予了? 为什么Mercurial认为Beyond Compare无法合并我的文件?
使用Beyond Compare作为合并程序的推荐Mercurial配置如下所示:
[merge-tools]
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp.exe
bcomp.args = $local $other $base $output
bcomp.priority = 1
bcomp.premerge = True
bcomp.gui = True
[ui]
merge = bcomp
Run Code Online (Sandbox Code Playgroud)
根据关于合并工具的Mercurial文档,默认情况下有一个binary
选项False
. 当binary=True
它告诉Mercurial 时,该工具可以合并二进制文件. 但是,当我打开该选项时,Mercurial仍然不会让Beyond Compare合并XML文件.
更多的研究提出了premerge
选择. 何时premerge=True
,Mercurial 首先在内部合并,并且仅在存在要解决的冲突时才使用合并工具. 不幸的是,Mercurial总是无法合并二进制文件.当合并失败时,Mercurial会停止该文件的合并,并且永远不会启动合并工具.
那么,解决方案似乎也是将premerge
选项设置为False
.不幸的是,预合并非常有用,因为90%的时间没有任何冲突,也从未见过你的合并工具.将premerge设置为False
,每次需要合并时,Beyond Compare打开.这非常繁琐.
为了解决这个问题,我创建了第二个Beyond Compare合并工具配置,用于合并二进制文件.我将其优先级设置为低于默认bcomp
工具,因此只有在主bcomp
工具失败时才会调用它,通常只用于二进制文件.我将这些行添加到merge-tools
我的mercurial.ini文件的部分:
bcompbin.executable = C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
bcompbin.args = $local $other $base $output
bcompbin.gui = True
bcompbin.premerge = False
bcompbin.binary = True
Run Code Online (Sandbox Code Playgroud)
其中一个副作用是Beyond Compare将启动合并无法处理的二进制文件.我还没有遇到过这种情况,所以不知道如何处理它.我可能只是暂时注释掉我的bcompbin
合并工具.
归档时间: |
|
查看次数: |
854 次 |
最近记录: |