SVN 으로 comment 를 잊어버리고 commit 하고는 한다. Edit Log Message 명령어로 수정해보려 하지만 "저장소가 리비전 속성을 바꿀 수 있지 못하도록 설정되었습니다. pre-revprop-change 훅을 생성해달라고 관리자에게 문의 하십시오."라는 에러 메시지가 보이며 수정이 되지 않았다. Edit Log Message 명령어를 이용할 수 있도록 'pre-revprop-change 훅'을 생성해보자.
저장소의 hooks 폴더를 보면 pre-revprop-change.tmpl 이 있다. 쉘스크립트를 지원하는 환경에서는 이 파일을 pre-revprop-change 로 바꾸면 아마 동작할 것 같다. 하지만 윈도우즈 계열에서는 훅으로 쉘스크립트를 사용하지 않는 관계로 동작하지 않는다.
윈도우즈 계열에서는 pre-revprop-change.bat 파일을 생성한다.
내용은 아래 내용을 입력한다.
로그 메시지 수정이 잘 되는지 확인해보자. :)
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5
:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME
:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION
:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY
goto :eof
:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit /b 1