conditions i have already checked are: 1. the commit message has to be at-least 10 characters long 2. the commit message should follow a JIRA issue key format ("ABCD-1234 #this is a test")
Now, i want to check the issue key "ABCD-1234" exists in JIRA with API.
using: SVN subversion
--CODE--
@echo off
:: Stops commits that have empty log messages.
@echo off
setlocal
rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2
rem check if message has minimum 10 characters
svnlook log %REPOS% -t %TXN%|findstr .......... > nul
if %errorlevel% gtr 0 (goto err1) else (goto continue)
:continue
rem check if message is matching with JIRA ID format
svnlook log %REPOS% -t %TXN%|findstr /r "^[A-Z]*-[0-9]*: *" > nul
if %errorlevel% gtr 0 (goto err2) else exit 0
:err1
echo. 1>&2
echo Your commit has been blocked because you didn't enter required characters in a comment. 1>&2
echo Write a log message describing the changes made and try again. 1>&2
exit 1
:err2
echo. 1>&2
echo Your commit has been blocked because you didn't enter required format in a comment. 1>&2
echo Write a log message describing the changes made and try again. EX. "<PROJECT ID>-<ISSUE NUMBER>: <MESSAGE>."1>&2
exit 1