2008-12-11 65 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