在SVN钩子中调用SVN propset不起作用

时间:2012-02-20 12:48:52

标签: svn svn-propset

如何在svn钩子中调用svn propset?

我的svn repo允许更改错误的svn:log属性。 它使用默认的pre-revprop-change模板实现。

我想修改默认的pre-revprop-change模板,并在其他修订版属性中保存旧历史记录。

所以我编写了脚本,在svn hook中调用svn propset:

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

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ];
then
echo "log01" >> /var/svn/history01.txt; #temp for testing
svn propset --revprop -r $REV  log:my "old_msg_for_history"
file:///var/svn/repo

exit 0; fi

if [[ $PROPNAME == log* ]];
then
        if [ "$ACTION" = "M"];
        then
        echo "log23 $REV" > /var/svn/history.txt; #temp for testing
        fi;
 exit 0; fi

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

直接调用时

svn propset --revprop -r 38041  log:my "msg_for_history" file:///var/svn/repo

一切正常

当我通过hook

调用undirectle时
svn propset --revprop -r 38041  svn:log "msg_for_history" file:///var/svn/repo

未调用svn propset,但会显示诊断消息

echo "log01" >> /var/svn/history01.txt; #temp for testing

为什么?

0 个答案:

没有答案