1

Navigate to TortoiseSVN on mine local box, open settings and 'Hook Scripts'. Click 'Add...' and entered below values

Hook Type post_commit_hook

Working Copy Path https:\svn.internal.net\svn\Release_Customer

Command Line to Execute C:\postCommitHook.bat

postCommitHook.bat file content is

"C:\Program Files\TortoiseSVN\bin\svnlook.exe" log -t %2 %1 | FindStr [a-zA-Z0-9]
IF %ERRORLEVEL% EQU 0 GOTO OK
echo "Commit Comments are Required" >&2
exit 1
:OK
exit 0

But when I commit from my local box code(pointing To https:\svn.internal.net\svn\Release_Customer) without any comment, i am still able to commit. Why my postCommitHook.bat is restricting it ?

Basically i an trying add the restriction to svn repo(https:\\svn.internal.net\svn\Release_Customer) where as batch script is lying on local box. Is it fine ?

user3198603
  • 5,528
  • 13
  • 65
  • 125

1 Answers1

0

You have two issues:

  1. If you want to block a commit from happening, it must happen in the pre-commit hook script. The post-commit hook executes after a successful commit, which is not helpful for your use case.
  2. The hook you've configured is local only to your computer, and for commits performed via TortoiseSVN. To install a hook script in the repository, you need an appropriate level of access to the filesystem on your SVN server itself, to place it in the hooks directory of the repository database itself. More info in the manual
alroc
  • 27,574
  • 6
  • 51
  • 97
  • Yeah first point i have already corrected. For second point, I believe i need to log in to server where SVN server (to path repos/hooks/) under is installed and create the pre-commit.bat(for windows) which will contain the task which i want to perform. Right ? But mine question is say i want to perform this task for specific SVN branch, will there be separate repo for each branch/trunk ? – user3198603 Jun 08 '17 at 02:36
  • Yes, but you need to have your server admin's agreement. Hook scripts are global to the repository they're installed in (executed on each event in the repo) but depending on how the script is coded, you can have it do different things for different paths. If your branches are in separate repositories, you have an unorthodox and probably broken setup. – alroc Jun 08 '17 at 02:41
  • Thats what my question. what repo actually is ? Say I have two svn branches branch1 and branch2, will there be separate repo_branch1 and repo_branch2 for them or there will be single repo directory ? – user3198603 Jun 08 '17 at 05:29
  • I can't tell you that because I don't have access to your repository. Check the svn info for the working copies of your branches to see if they have the same repository root and UUID. They all should be in the same repository as I said in my previous comment. – alroc Jun 08 '17 at 10:06