The issue isn't a TortoiseSVN issue, but a server issue. Where is the repository stored? What server are you using? Are you using svnserve
or httpd
?
I take it that your commit happens anyway. There are several possibilities:
Your hook is being executed, but not doing anything. As long as it exits with a zero exit status, Subversion thinks everything is hunky. Try a Subversion program called
pre-commit.bat
that contains only the lineexit 2
. If you can still commit stuff, your hook isn't working at all.Your hook isn't being executed. Subversion executes the program
pre-commit
in thehooks
directory. There is an environment variable calledPATHEXT
on Windows that contains the suffixes that will be appended to a file in order to find the executable. Usually, it tries*.com
,*.exe
and then*.bat
. If there is apre-commit.exe
orpre-commit.cmd
in thathooks
directory, yourpre-commit.bat
won't be executed. Check the value ofPATHEXT
for the user executing your Subversion server, and make sure it is set correctly.
One of the issues is that Subversion's hooks eat STDOUT and will only display STDERR only when the hook fails. This makes hooks pretty uncommunicative for the user, and if you're depending upon printing output while executing, you may get the felling that your hook isn't doing anything.
Print stuff to STDERR and not STDOUT. Have a way to force a hook to fail, so you can see STDERR if you need to.
I also don't recommend writing hooks in batch script on Windows. It simply isn't cut out to do this type of work. Use Python or Perl. Or, if you are really that PC oriented and don't want to install Python or Perl on your server, use PowerShell which is a very powerful, but underutilized programming language for Windows.