2008-12-11 30 views
0

如何更新我的Subversion存儲庫,以便它可以接受日誌消息字段的更新?我已經安裝了Windows,並將pre-revprop-change.tmpl文件名更改爲批處理文件,但是現在,當我嘗試更新日誌消息屬性時,我的烏龜svn只是掛起並且屬性未更新。難道我做錯了什麼?如何更新Subversion中的屬性

自公司這麼小,我的pre-revprop-change.bat文件低於

REPOS="$1" 
REV="$2" 
USER="$3" 
PROPNAME="$4" 
ACTION="$5" 

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi 

echo "Changing revision properties other than svn:log is prohibited" >&2 
exit 1 

回答

1

這不是一個正確的批處理文件;您需要使用cmd.exe批處理語法。

Here是一個示例,您可能想嘗試(也許經過調整後)。

1

這是我最終使用的文件,我無法調試檢查的部分,以確保日誌消息不是空的,如果有人可以,我會很感激。很明顯,我意識到我評論了它。

@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 not %propname%==svn:log goto ERROR_PROPNAME 

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
:: Only allow modifications to svn:log (no addition/overwrite or deletion) 
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
if not %action%==M goto ERROR_ACTION 

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
:: Make sure that the new svn:log message contains some text. 
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
::set bIsEmpty=true 
::for tokens=* %%g in (find "") do ( 
:: set bIsEmpty=false 
::) 
::if %bIsEmpty%==true goto ERROR_EMPTY 

exit 0 



: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. You tried %propname% >&2 
goto ERROR_EXIT 

:ERROR_ACTION 
echo Only modifications to svn:log revision properties are allowed. >&2 
goto ERROR_EXIT 

:ERROR_EXIT 
exit 1