我看到this發佈,它解釋瞭如何讓BC3作爲Subversion的差異工具工作......但使用Beyond Compare 3做3路合併/比較怎麼辦?如何使用Beyond Compare 3作爲svn的diff3-cmd?
10
A
回答
8
爲此,創建一個名爲(例如)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
1
我只有BC3和TFS的經驗,所以帶上一粒鹽。 3路合併是我遇到的唯一問題。不止一次,我必須在BC3中手動複製和粘貼更改以完成合並。
+1
我在Windows上使用BC3通過龜。我可以說,BC3所做出的決定始終比Tortoise或SVN cli本身更爲準確。我還爲特定的文件類型/模式創建自定義配置文件,以便覆蓋默認值。 – 2009-09-08 21:26:31
4
我喜歡liamf的批處理文件,但我認爲它可能需要一個小的調整:
我添加automerge和reviewconflicts的命令調用,以便在合併的情況下,不會發生衝突,它只是在沒有干預的情況下關閉 - 用戶界面只會彈出來審查衝突。
因此,有問題的行變成了:
%DIFF3% /automerge /reviewconflicts /lefttitle=%MYTITLE% /centertitle=%OLDTITLE% /righttitle=%YOURTITLE% /outputtitle="Merge Output" %MINE% %YOURS% %OLDER% %OUTPUTFILE%
1
這裏是liamf的腳本,使用svn 1.6工作的一個Linux版本。
#!/bin/bash
MYTITLE=$4
OLDTITLE=$6
YOURTITLE=$8
MINE=$9
OLDER=${10}
YOURS=${11}
OUTPUTFILE=${MINE}.merge
/usr/bin/bcompare -solo -automerge -force -reviewconflicts -favorleft -lefttitle=$MYTITLE -centertitle=$OLDTITLE -righttitle=$YOURTITLE -outputtitle=$OUTPUTFILE $MINE $YOURS $OLDER $OUTPUTFILE
RESULT=$?
if [ $RESULT -eq 0 ] ; then
cat $OUTPUTFILE
exit 0
else
exit 1
fi
1
這裏有一個Cygwin的 bash腳本,與顛覆1.7同時適用於DIFF-CMD和的diff3-CMD
#!/bin/bash
# Set path to BeyondCompare
bcomp=~/bin/bcomp;
function bcerrlvl() {
echo -en "$1\t";
case $1 in
0) echo "Success";;
1) echo "Binary same";;
2) echo "Rules-based same";;
11) echo "Binary differences";;
12) echo "Similar";;
13) echo "Rules-based differences";;
14) echo "Conflicts detected";;
100) echo "Error";;
101) echo "Conflicts detected, merge output not saved";;
*) echo "Error";;
esac;
return $1;
}
if [ "$1" = "-u" ];
then
# paths
left=$(cygpath --dos "$6");
right=$(cygpath --dos "$7");
# titles
titleleft="$3";
titleright="$5";
# compare command
$bcomp -title1="$titleleft" -title2="$titleright" "$left" "$right";
if [ $? -gt 0 ];
then
bcerrlvl $?;
exit $?;
else
exit 0;
fi;
elif [ "$1" = "-E" ];
then
# Get to the tenth and eleventh arguments
shift; shift;
# paths
centre=$(cygpath --dos "$7");
left=$(cygpath --dos "$8");
right=$(cygpath --dos "$9");
outext="_$(date +%s)-$RANDOM.merge";
output="$(cygpath --dos "$8")_$outext";
# titles
titlecentre=$2;
titleleft=$4;
titleright=$6;
titleoutput="Merge Output";
# compare command
$bcomp -title1="$titleleft" -title2="$titleright" -title3="$titlecentre" \
-outputtitle="$titleoutput" -automerge -reviewconflicts \
"$left" "$right" "$centre" "$output";
if [ $? -eq 0 ];
then
outfile=$(cygpath --unix "$output");
cat $outfile
rm -f $outfile
exit 0;
else
bcerrlvl $?;
exit $?;
fi;
fi;
相關問題
- 1. Git Diff with Beyond Compare
- 2. 如何配置Visual Studio 2012以使用Beyond Compare 3
- 3. 如何在Windows上使用Beyond Compare 3作爲外部SVN(SlikSVN)合併和差異化工具?
- 4. Beyond Compare 2忽略情況
- 5. 爲什麼衝突標記不會在Git mergetool中使用Beyond compare 3消失?
- 6. Eclipse SVN:如何使用Compare With ...分支?
- 7. 在Eclipse中使用Beyond Compare進行Subversion中的合併
- 8. 使用Beyond Compare(Mercurial)解決合併衝突
- 9. 如何讓Beyond Compare正確處理.hgtags文件?
- 10. 如何在Beyond Compare 4中設置多個列線(網格線)?
- 11. 如何使Beyond Compare忽略空白,但仍顯示註釋中的更改
- 12. 在Windows 7 64位上集成Beyond Compare 3與基本清晰版本8?
- 13. 如何僅報告右側文本與Beyond Compare比較中的差異?
- 14. Beyond Compare忽略所有文件中不重要的差異
- 15. Beyond Compare - 刪除不必要的內容(BETWEEN「)
- 16. TFS:自動簽出在Beyond Compare中修改的文件
- 17. 忽略解決方案中的文件夾與Beyond Compare比較
- 18. 如何在Beyond Compare中創建特定會話的快捷方式?
- 19. Beyond Compare - 如何在比較時忽略TFS文件的只讀標誌
- 20. 使用Beyond Compare作爲數據文件時,我可以有多個關鍵標識符嗎?
- 21. 使用Beyond Compare 3,如何生成比較兩個給定文件夾的報告,並顯示使用腳本在每個文件中更改了多少行
- 22. 如何在findOneBy中使用'compare'語句?
- 23. 在Linux上尋找Perforce的差異編輯器,類似於Beyond Compare?
- 24. compareTo和compare比較工作如何?
- 25. Beyond Compare - 如何忽略'這是一個句子'和'這是\ n句子'之間的區別
- 26. 如何使用git-svn作爲SVN存儲庫的中間審查工具?
- 27. 使用vim作爲svn的差異
- 28. 如何使用SVN與無法比擬的3
- 29. 如何使用Git svn的
- 30. eclipse + svn:如何使用svn管理整個工作區
根據SVN紅皮書對此的看法,這看起來是正確的......我一接受檢查就會接受答案。 – paxos1977 2009-09-12 18:20:06
我剛測試過它,它工作正常(一旦你用你的盒子的正確安裝路徑替換了設置的DIFF3行)。 – 2011-01-14 22:17:59