如何在Windows上将Beyond Compare 3用作外部SVN(SlikSVN)合并和差异工具?

问题描述:

我想将Beyond Compare 3配置为SVN命令行客户端SlikSVN作为外部差异和合并工具.该怎么做?

I want to configure SVN command line client SlikSVN with Beyond Compare 3 as external diff and merge tool. How to do this?

  1. Beyond Compare 3文件夹添加到Windows PATH.如果您不知道如何检查此答案-只需将Python路径替换为Beyond Compare 3路径即可.

  1. Add Beyond Compare 3 folder to Windows PATH. If you don't know how check this answer - just replace Python path with Beyond Compare 3 path.

Beyond Compare 3文件夹中创建bcomp-diff.bat文件:

@ECHO OFF

SET DIFF="bcomp.exe"

SET LEFT=%6
SET RIGHT=%7

%DIFF% %LEFT% %RIGHT%

  • Beyond Compare 3文件夹中创建bcomp-merge.bat文件:

  • In Beyond Compare 3 folder create bcomp-merge.bat file:

    @ECHO OFF
    
    SET DIFF3=BComp.exe
    
    SET BASE=%1
    SET THEIRS=%2
    SET MINE=%3
    SET MERGED=%4
    
    REM left MINE
    REM center BASE
    REM right THEIRS
    %DIFF3% %MINE% %THEIRS% %BASE% %MERGED%
    

  • 现在我们需要编辑SlikSVN配置文件.在Windows 7上,它位于%USERPROFILE%\AppData\Roaming\Subversion()中.只需将其粘贴到Windows资源管理器地址栏中,然后编辑config文件即可.

  • Now we need to edit SlikSVN config file. On Windows 7 it is located in %USERPROFILE%\AppData\Roaming\Subversion (source). Just paste this into Windows Explorer address bar and edit config file.

    config文件的[helpers]部分中,如下添加/修改:

    In [helpers] section of config file add/modify as below:

    diff-cmd = bcomp-diff.bat
    merge-tool-cmd = bcomp-merge.bat
    

  • 重新启动cmd.exe,以便重新加载PATH Windows变量.

  • Restart cmd.exe so that PATH windows variable will be reloaded.

    您完成了!在存储库中尝试svn diff,它应该运行Beyond Compare 3.

    You're done! Try svn diff inside your repository and it should run Beyond Compare 3.

    我已经使用上述批处理文件制作了要点.

    I've made a gist with above batch files.

    批处理文件基于此网站.