如何更新subversion中的属性

时间:2021-07-21 07:27:20

How do I update my subversion repository so it can accept updates to the log message field? I've got a Windows installation and I changed the pre-revprop-change.tmpl file name to a batch file, but now when I try to update a the log message property my tortoise svn just hangs and the property isn't updated. Am I doing something wrong?

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

Since its so small, my pre-revprop-change.bat file is below

由于它很小,我的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 个解决方案

#1


1  

That's not a proper batch file; you need to use cmd.exe batch syntax.

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

Here is an example that you might want to try (after adjustments perhaps).

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

#2


1  

Here is the file I ended up using, I couldn't debug the part that checks to make sure the log message isn't empty, if someone could I'd appreciate it. Obviously I realize that I commented it out.

这是我最终使用的文件,我无法调试检查以确保日志消息不为空的部分,如果有人可以我欣赏它。显然我意识到我评论了它。

@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 

#1


1  

That's not a proper batch file; you need to use cmd.exe batch syntax.

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

Here is an example that you might want to try (after adjustments perhaps).

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

#2


1  

Here is the file I ended up using, I couldn't debug the part that checks to make sure the log message isn't empty, if someone could I'd appreciate it. Obviously I realize that I commented it out.

这是我最终使用的文件,我无法调试检查以确保日志消息不为空的部分,如果有人可以我欣赏它。显然我意识到我评论了它。

@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