还在苦苦敲代码开发APP?你out啦! 试试积木搭建APP吧~

TortoiseSVN允许修改日志的方法

来源:清泛编译     2016-02-24 14:51:09    人气:     我有话说( 0 人参与)

SVN默认是不允许修改日志的,否则报错:可以通过服务端的hooks目录下的批处理使得SVN日志可修改。Windows版:服务器端svn仓库hooks目录下加...

SVN默认是不允许修改日志的,否则报错:

可以通过服务端的hooks目录下的批处理使得SVN日志可修改。


Windows版:

服务器端svn仓库hooks目录下加入一个批处理文件:pre-revprop-change.bat

@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 /I not '%propname%'=='svn:log' goto ERROR_PROPNAME
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow modifications to svn:log (no addition/overwrite or deletion)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not '%action%'=='M' goto ERROR_ACTION
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Make sure that the new svn:log message contains some text.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
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 properties are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log revision properties 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 1

但存在一个问题:强制设定commit时写一定长度的日志功能失去。


Linux版:

#cd /opt/svn/repos/hooks
#mv pre-revprop-change.tmpl pre-revprop-change
#chmod 755 pre-revprop-change

 

无需重启svn服务,即可生效,通过“Edit log message”就可以修改svn日志了:

TortoiseSVN SVN 修改日志

注:本文为本站或本站会员原创优质内容,版权属于原作者及清泛网所有,
欢迎转载,转载时须注明版权并添加来源链接,谢谢合作! (编辑:admin)
分享到: