2

I've made pre-commit.bat script, but it doesn't work properly.
I want it to prevent sending commits without proper message("Ticket xxxxx").

Here's the code:

set REPOS=%1  
set TXN=%2  
svnlook log %REPOS% -t %TXN% | findstr /r "^Ticket [0-9]{5}" > nul || echo   "Follow the format [Ticket xxxxx ...]" 1>&2 && exit 1  
exit 0  

And here's what I get when I try to commit:

The hook script returned an error:  
svnlook: E720003: Can't open file 'C:\Users\EDUARD~5.LI\AppData\Local\Temp\3\svn4FA6.tmp\format': The system cannot find the path specified.    
"Follow the format [Ticket xxxxx ...]"

Settings for the hook are:
Working copy path - D:\test\testwc
Command line to execute - D:\test\hooks\pre-commit.bat

Subversion client - TortoiseSVN

I'm trying to commit changes of the "D:\test\testwc\test.txt" file.

Thank you in advance!

Eduard Climov
  • 165
  • 1
  • 15
  • I guess you are setting up a client-side hook script, but the `svnlook` tool is designed for server-side usage; I think `svn log` is the suitable client-side tool; or -- even better -- use the parameter `%3` (like `set "MESSAGEFILE=%~3"`), and then use `type "%MESSAGEFILE%" | > nul findstr /R "^Ticket [0-9][0-9][0-9][0-9][0-9]" || (>&2 echo Follow the format [Ticket xxxxx ...]) & exit /B 1` (see the quotes around the path, the corrected regular expression and the changed operator `&` instead of `&&`)... – aschipfl Jun 20 '16 at 12:43
  • Did you get a satisfactory answer, Eduard? – David White Sep 01 '16 at 04:02
  • No, unfortunately. @DavidWhite – Eduard Climov Sep 01 '16 at 06:29

0 Answers0