I have implemented the below code in my hook script file abc-pre-commit.bat
to disallow commit if files contain the string cod_bank
SETLOCAL
SET PATH=C:\Windows;C:\Windows\system32;D:\SCC\SVN146\ bin;C:\Program Files\VisualSVN Server\bin;
set SVNLOOK = "C:\ProgramFiles\VisualSVNServer\bin\svnlook.exe"
set REPOS=%1
set TXN=%2
%SVNLOOK% diff %REPOS% -t %TXN% | findstr /I /M /L cod_bank > nul
if %errorlevel% gtr 0 (
exit 0
) else (
echo Your commit has been blocked because it contains the keyword cod_bank. 1>&2
exit 1
)
My file does contains the string cod_bank
OUTPUT: in commit window it shows
commit blocked by pre-commit-hook
It does not displays the echo msg also how can I store the o/p of the svnlook diff command. I tried but was not successful.
In Linux It works like this: