Skip to content Skip to sidebar Skip to footer

Can't Fail Svn Pre-commit Script With Windows Server

I`m writing an SVN pre-commit.bat file which calls a Python script to query our issue tracking system to determine of the user-supplied issue tracking ID is in the correct state (e

Solution 1:

Try changing exit 1 to exit /b 1. exit will quit the command interpreter (cmd.exe); exit /b will quit the current batch script but not the command interpreter.

exit 1 may be closing the command interpreter in which the pre-commit script is running, so the exit code isn't available to SVN if it's also running under the same command interpreter.

Solution 2:

Thanks for the suggestions however I have found the solution.

Earlier I had convinced myself otherwise, but the error was in fact in the Python script. Essentially "sys.exit(0)" was executing when I thought that "sys.exit(1)" was.

Below I've slightly improved the comments in the echo statements from the previous .bat file, and I can confirm these do show up in the TortoiseSVN GUI window.

\Python26\python svn_sync.py -s --repos=%repos% --transaction=%transaction% --project=%proj%   

IF %ERRORLEVEL% GTR 0 GOTO err 

echo ___________________ 1>&2  
echo Commit successful.  1>&2  
echo ___________________ 1>&2  
exit 0 

:err
echo _____________________________________________________ 1>&2  
echo Your commit has failed due to invalid PR or PR state. 1>&2  
echo _____________________________________________________ 1>&2  
exit 1

Post a Comment for "Can't Fail Svn Pre-commit Script With Windows Server"