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.g. "open" state) and associated with the right project. The SVN server is running Windows (2003 server I think - I can check with our IT group if it matters...).
The issue is that I can't seem to make the SVN commit fail*; it always succeeds. AFAIK the Python script is doing what it should; it calls "sys.exit(1)" for failures (and "sys.exit(0)" for success). For the .bat file I have adapted some examples in this forum which are said to work and as of yet, no luck. Here's the slightly simplified .bat file,
@echo off
set repos=%1
set transaction=%2
set proj=ferry
\Python26\python svn_sync.py -s --repos=%repos% --transaction=%transaction% --project=%proj%
IF %ERRORLEVEL% GTR 0 (GOTO err) else exit 0
REM This should return a failure to Subversion, but does not
:err
echo 1>&2
echo Your commit has failed due to invalid PR or PR state. 1>&2
echo Thanks 1>&2
exit 1
Again I know that the script is being run (i.e. not a env variable issue on the server), and the sys.exit(1)
code is being hit. Also I`m quite sure the 'err' function getting run, it is simply that the "exit 1" return code is getting ignored by SVN?
*Note: Not quite true; the only way I have ever made a commit fail is when the Python script has a run-time error. Generating an intentional run-time error, however, is not an acceptable work-around in this case.
Thanks for your interest.