Found one of the useful SVN pre-commit hook in SVN pre-commit hook for avoiding changes to tags subdirectories by mcdon.
I want to add the validation check on the user before committing. Can I do something like below?
@echo off
REM user1, user2, user3 are example
set VALID_USERS=user1,user2,user3
set SVNROOT="C:\Program Files\CollabNet Subversion Server\svnlook.exe"
set REPOS=%1%
set TXN=%2%
%SVNROOT% author %REPOS% -t %TXN% | findstr /r "^%VALID_USERS%$" >nul
if %errorlevel% EQU 0 (
echo This is an invalid user 1>&2
exit 1
) else (
echo This is valid user 1>&2
exit 0
)
The above pre-commit script failed as all users can commit their files. Also, the 'echo' command not working as I don't see any echo statement above. Can anyone help?