I want to cut a string (BUGID) from a commit log message and then validate it from a list of available bugids (a text file) and if that id is invalid then pre -commit hook should block that commit. For eg:
File added Defect ID:12345
I want to cut "Defect ID:12345 " from log message and want to validate from a text file placed at SVN location. I am using windows and need to write pre -commit hook in bat file. I tried following but its not working .I am not getting any outut.Please help
For /F "delims=" %%I in (`svnlook log %REPOS% -t %TXN%`) Do (Set Message=!Message!%%I)
rem Make sure that the log Message contains some text.
echo "%Message%" 1>&2
echo "%Message%" | FindStr [a-zA-Z0-9] >nul
IF %ERRORLEVEL% NEQ 0 (GOTO COMMENT_NOT_OK) else GOTO OK
:COMMENT_NOT_OK
echo COMMENT_NOT_OK 1>&2
echo Your commit has been blocked because you didn't provide adequate log Message 1>&2
echo Please write a log Message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
if %DEBUG% EQU 1 GOTO EXITDEBUG
exit 1
:OK
if %DEBUG% EQU 1 GOTO EXITDEBUG
exit 0
:EXITDEBUG
echo == EXITDEBUG == 1>&2
exit 0
referred link : Getting log message from svnlook via windows batch