1、svn客户端修改日志功能(且只能修改自己日志)
找到版本库中hooks目录下,将pre-revprop-change.tmpl文件复制为pre-revprop-change.bat文件,然后将pre-revprop-change.bat文件内容改为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
set repos=%1 set rev=%2 set user=%3 set propname=%4 set action=%5 for /f "usebackq" %%k in (`svnlook author %repos% -r %rev%`) do @set var=%%k set rightUser=0 if "%3" == "%superUser%" set rightUser=1 if "%3" == "%var%" set rightUser=1 if %rightUser% == 0 goto ERROR_USER goto :SUCCESS_EXIT :ERROR_USER echo 只允许用户修改自己的日志 >&2 goto ERROR_EXIT :ERROR_EXIT exit 1 :SUCCESS_EXIT exit 0 |
2、到版本库中hooks目录下,将pre-commit.tmpl文件复制为pre-commit.bat文件,然后将pre-commit.bat 文件内容改为:
1 2 3 4 5 6 7 8 9 10 |
setlocal set REPOS=%1 set TXN=%2 rem check that logmessage contains at least 5 characters svnlook log "%REPOS%" -t "%TXN%" | findstr ".........." > nul if %errorlevel% gtr 0 goto err exit 0 :err echo 提交必须写日志!>&2 exit 1 |