svn - 如何使用 Beyond Compare 3 作为 svn 的 diff3-cmd?

标签 svn beyondcompare3 three-way-merge

我看到了this帖子解释了如何让 BC3 作为 Subversion 的 diff 工具工作...但是使用 Beyond Compare 3 进行 3 路合并/比较怎么样?

最佳答案

为此,请创建一个名为 diff3wrap.bat 的批处理文件,并在 SVN 配置中设置 diff3-cmd 以指向它。

下面的 diff3wrap.bat 文件将完成这项工作。它为合并输出创建一个临时文件名,并在将合并内容返回到 SVN 后将其删除。

@ECHO OFF

SET DIFF3="C:\Program Files\BeyondCompare3\BComp.exe"

REM Subversion provides the paths we need as the last three parameters
REM These are parameters 9, 10, and 11.  
REM Suitable titles for these three panes in the merge tool are in parameters 4, 6 and 8 respectively.


REM But we have access to only nine parameters at a time, so we shift our nine-parameter window
REM twice to let us get to what we need, thus changing the effective positions of the various parameters.
REM
SHIFT
SHIFT
SET MYTITLE=%2
SET OLDTITLE=%4
SET YOURTITLE=%6
SET MINE=%7
SET OLDER=%8
SET YOURS=%9
SET OUTPUTFILE=%OLDER%_%RANDOM%.merge

REM Call BeyondCompare to perform the actual merge
REM Note we give it a temporary output file and echo the output back out for SVN to use as the merged file
%DIFF3% /lefttitle=%MYTITLE% /centertitle=%OLDTITLE% /righttitle=%YOURTITLE% /outputtitle="Merge Output" %MINE% %YOURS% %OLDER% %OUTPUTFILE% 

if NOT %errorlevel% == 0 goto :mergenotcomplete

REM Merge complete. Echo the output to stdout for SVN to pick up as the result, then throw away the temporary file

TYPE %OUTPUTFILE%
del /f /q %OUTPUTFILE%
exit 0

:mergenotcomplete
exit 1

关于svn - 如何使用 Beyond Compare 3 作为 svn 的 diff3-cmd?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1028694/

相关文章:

svn - 选择分支策略来满足我们的部署需求

Eclipse Unable to Launch,选择无法启动,最近没有启动

git - 使用 Git 时在 Visual Studio 2013 中设置 Beyond Compare

BeyondCompare3 - 如何一次查看多个文件的确切差异?

git - 为什么 merge 需要您考虑共同的祖先?

svn-externals 与自己的 svn-externals : how to recursively checkout?

svn - 如何查询我的 Subversion 存储库?

beyondcompare3 - Beyond Compare 3 忽略大小写

merge - 使用 Meld 视觉差异和合并工具处理 [re] 移动的行

merge - 为什么 3 路合并比 2 路合并更有优势?