1

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 
1
  • I think question tags aren't quite correct. You seem to be asking how to to match strings from Windows batch scripts and not really anything about Subversion, TortoiseSVN, Visual SVN Server or Jira. Commented May 22, 2020 at 17:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.