@echo off :: Set all parameters set repository=%1 set repopath=%2 set user=%3 :: Set path to svnlook set svnlook=%VISUALSVN_SERVER%bin\svnlook.exe :: First check that the lock exists already. :: In that case svnlook prints the lock description. "%svnlook%" lock "%repository%" %repopath% | findstr /B /L "UUID Token:" > NUL 2>&1 :: If the lock does not exist, do nothing if ERRORLEVEL 1 exit 0 :: Now check the lock's owner "%svnlook%" lock "%repository%" %repopath% | findstr /C:"Owner: %user%" > NUL 2>&1 :: If the person locking matches the lock's owner, allow unlocking if %ERRORLEVEL% EQU 0 exit 0 :: Otherwise, return failure exit 1