修改SVN項目日誌

如在修改SVN項目日誌的時候提示如下錯誤信息,說明SVN默認不允許直接修改LOG文件,實現在HOOK文件夾中實現相關勾子腳本去打開。


在SVN數據庫的HOOK目錄下創建"pre-revprop-change.bat"文件( http://pan.baidu.com/s/1kTkPAg3),並輸入以下信息即可。

@ECHO OFF


set repos=%1


set rev=%2


set user=%3


set propname=%4


set action=%5


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: Only allow changes to svn:log. The author, date and other revision


:: properties cannot be changed


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


if /I not '%propname%'=='svn:log' goto ERROR_PROPNAME


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: Only allow modifications to svn:log (no addition/overwrite or deletion)


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


if /I not '%action%'=='M' goto ERROR_ACTION


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: Make sure that the new svn:log message contains some text.


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


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 properties are not allowed. >&2


goto ERROR_EXIT


:ERROR_PROPNAME


echo Only changes to svn:log revision properties 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 1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章