본문 바로가기

TroubleShooting/Etc

svn diff 를 vimdiff 로 변경하는 방법

728x90
 svn 에서 변경사항 확인시, diff 를 많이 사용하지만 window 용보다는 활용도가 떨어진다. svn 은 editor 뿐만 아니라, diff 프로그램도 타 프로그램을 직접 등록할 수 있다. 그래서 vimdiff 연동되는 방법을 알아보았다.
 svn books(http://svnbook.red-bean.com/en/1.4/svn.advanced.externaldifftools.html) 에서 해당 내용을 추출해서 정리하자면,
 작업 환경이 리눅스라면 적당한 홈 디렉토리(/root/diffwrap.sh) 에 아래와 같은 sh 파일을 하나 만든다. 물론 실행 권한을 주고..
-----------------------------------------------------
#!/bin/sh
# Configure your favorite diff program here. 
DIFF="/usr/bin/vimdiff" 
# Subversion provides the paths we need as the sixth and seventh 
# parameters. 
LEFT=${6}
RIGHT=${7}
# Call the diff command (change the following line to make sense for # your merge program). 
$DIFF $LEFT $RIGHT 
# Return an errorcode of 0 if no differences were detected, 1 if some were. 
# Any other errorcode will be treated as fatal.
-----------------------------------------------------
  그리고, 홈디렉토리의 .subversion/config 파일에서 [helpers] 항목에서 주석문으로 막힌 diff-cmd 를 풀고 sh 파일 위치를 저장한다.
----------------------------------------------------
[helpers]
diff-cmd = /root/diffwrap.sh
----------------------------------------------------

 변경사항에 대해서 svn diff 를 실행해보면 vimdiff 와 동일한 화면 형태(왼쪽,오른쪽 창들)를 볼 수 있게 된다.

 참고 사이트 :