使svn根据文件扩展名自动检测diff-cmd和diff3-cmd


Git中,可以在.gitattributes中指定这些并执行一些其他配置:

git config diff.difftool.command ...
git config merge.mergetool.driver ...

在Mercurial中,可以在hgrc文件中指定模式([diff-patterns]和[merge-patterns]部分).

如何在Subversion中实现这一目标?

最佳答案
red-book for Subversion(通常是所有知识的来源)在这里并不太具体.它指出可以选择配置diff-cmd和diff3-cmd,并且可以为调用添加扩展名.

但是,它说明了以下内容:

The decision on when to fire off a contextual two- or three-way diff as part of a larger Subversion operation is made entirely by Subversion and is affected by, among other things, whether the files being operated on are human-readable as determined by their svn:mime-type property. This means, for example, that even if you had the niftiest Microsoft Word-aware differencing or merging tool in the universe, it would never be invoked by Subversion as long as your versioned Word documents had a configured MIME type that denoted that they were not human-readable (such as application/msword).

它没有说明如何影响这个决定:-(

如果您使用的是TortoiseSVN工具,则会包含配置选项,以指定所考虑文件的每个mime类型使用的差异工具.该配置的路径是:TortoiseSVN>设置>外部程序> Diff Viewer>高级….也许这是你的选择.

我个人的观点是,颠覆团队认为你应该使用包装器作为差异工具,并在那里决定使用哪种工具与基于mime类型的特定配置.

点赞