Cornerstone 3 添加外部diff工具
因Mac上的svn工具Cornerstone的diff工具十分不好用,并且比對不精確,所以想在Cornerstone內(nèi)調(diào)用第三方diff工具。個人使用DiffFork進行比對。
DiffFork還提供shell方式打開軟件可以軟鏈到/usr/local/bin/difffork
但是我通過shell方式打開后是生成了2個比對窗口,2個文件沒能在一起比對,所以使用了applescript方式。
但是BeyondCompare可以通過shell方式正確打開,但是Mac下的BeyondCompare對中文不友好所以就用DiffFork了。
shell調(diào)用方式:
- #!/bin/bash
- original_path="$1"
- modified_path="$3"
- /usr/local/bin/bcompare "$original_path" "$modified_path"
DiffFork提供的applescript調(diào)用示例:
- (*
- diff v: Diff
- diff item : the old item.
- against item : the new item.
- *)
- set theOld to (choose file with prompt "Select Old:")
- set theNew to (choose file with prompt "Select New:")
- tell application "DiffFork"
- activate
- diff theOld against theNew
- end tell
因為Cornerstone的外部工具只支持*.sh的所以修改了DiffFork提供的applescript以shell方式打開。
- #!/bin/bash
- osascript -e 'tell application "DiffFork"' -e "activate" -e "diff \"$1\" against \"$3\"" -e 'end tell'
下面是BeyondCompare的調(diào)用方式:
- #!/bin/bash
- original_path="$1"
- modified_path="$3"
- /usr/local/bin/bcompare "$original_path" "$modified_path"
【本文是51CTO專欄作者張勇波的原創(chuàng)文章,轉(zhuǎn)載請通過51CTO獲取作者授權(quán)】