SVN修改日志限制脚本

@echo off
set SVN_BINDIR=C:\"Program Files"\"VisualSVN Server"\bin
setlocal enableextensions enabledelayedexpansion
set repos="%1"
set rev="%2"
set user="%3"
set propname="%4"
set action="%5"

set superUser=admin
set s=%SVN_BINDIR%\svnlook author "%repos%" -r "%rev%"
rem usebackq 中的集合对于路径用双引号,字符串用单引号,命令用后引号,这里用的就是后引号。
for /f "usebackq" %%k in (`%s%`) 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 you can only modify your own log. >&2
exit 1

:SUCCESS_EXIT
IF %propname% == "svn:log" exit 0
ECHO "Changing revision properties %propname% is prohibited" >&2
EXIT 1

你可能感兴趣的:(SVN,hook)