我在SVN的评论中留下了一个错误,提交后还能编辑吗?
提交信息是"未版本化的属性", 可以使用svn propset命令进行更改,例如
$ svn propset --revprop -r 25 svn:log "Journaled about trip to New York."
property 'svn:log' set on repository revision '25'
这是在第25个版本上设置名为"svn:log"的修订属性。
由于它们没有版本控制,因此默认安装的subversion不会允许您修改这些属性,除非您提供一个pre-revprop-change钩子脚本。
以下是我系统上/var/lib/svn/hooks/pre-revprop-change中的典型脚本:
#!/bin/sh
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then
echo "$1 $2 $3 $4 $5" >> /var/lib/svn/logchanges.log
exit 0;
fi
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5
:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME
:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION
:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY
goto :eof
:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit /b 1
如果不想创建一个 pre-revprop-change 钩子脚本,可以使用下面的 svnadmin
命令 来快速更改日志消息:
svnadmin setlog --bypass-hooks REPOS_PATH -r N FILE
其中REPOS_PATH
是服务器上存储库的路径(例如/srv/svn/repository),N
是修订版本号(例如25),FILE是包含正确提交日志条目的文本文件。
两点需要注意: 这需要访问存储库文件系统,但创建pre-revprop-change挂钩脚本也需要访问文件系统... 另外,该命令将绕过可能存在的任何挂钩脚本,因此请谨慎使用...
svn propset svn:log --revprop -r <REVISION> "My corrected log message" <PATH-TO-REPOSITORY>