Hi all, i've got the below script which detects if a file is already locked and if so displays a message to the user. What I want to also display is the user which currently has the file locked but can't work it out.
Below is my current script. Anyone know how to get and display the lock owner of a file?
@echo off
:: Set all parameters
set repository=%1
set repopath=%2
set user=%3
:: Set path to svnlook
set svnlook=C:\Program Files\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, allow locking
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 locking
if %ERRORLEVEL% EQU 0 exit 0
:: Otherwise, return failure
echo "Error: %repopath% is already locked by ???" >&2
exit 1
Last updated