如何更新subversion中的属性

时间:2008-12-11 21:05:40

标签: svn

如何更新我的subversion存储库以便它可以接受对日志消息字段的更新?我有一个Windows安装,我将pre-revprop-change.tmpl文件名更改为批处理文件,但是现在当我尝试更新日志消息属性时,我的tortoise svn只是挂起而且属性没有更新。难道我做错了什么?

由于它很小,我的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

2 个答案:

答案 0 :(得分:1)

这不是一个合适的批处理文件;您需要使用cmd.exe批处理语法。

Here是您可能想要尝试的示例(可能在调整之后)。

答案 1 :(得分: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