My post-commit hook is never triggered and i think it's because
there is some filesystem permissions i need to set.
I have VisualSVN-Server-2.5.2 installed and running eclipse with Subversion pluggin.
Everything is working as expected except for the VisualSVN hook triggering.
This is my post-commit.cmd file with the name "post-commit.cmd"
C:\PROGRA~2\VISUAL~1\bin\myScript.cmd
exit 0
UPDATE 1
when i put the "start" text like this the Commit window freezes with a pulsating progress-green bar, like it waiting for the hook triggering or somehing.I cannot
cancel commit operation but i can close eclipse and then hard-kill the commit window.
start C:\PROGRA~2\VISUAL~1\bin\post-commit.cmd
exit 0
UPDATE 2
It's working if a save the repository to local hdd. It's when save-path is for network drive that its not working. Ok that's a forward step. the bath file need some user/password maybe
Here's the bat file that saves the repository to local hdd(thanks to Christopher C. Simmons (CCS))
@ECHO OFF
CLS
:: =================== COPYRIGHT =========================================
:: File: svn_backup.bat
:: Author: Christopher C. Simmons (CCS)
:: Date: 05.01.2008
:: Purpose: To make backups ("hot copies") of multiple SVN repos
:: History: 0.1 Initial Release
:: Assumes: Your path contains: C:\Program Files\Subversion\bin
:: Your repodir contains only repos
:: Copyright: 2008 csimmons.net
::
:: NOTICE!!!
:: csimmons.net, LLC supplies this software AS IS and makes no guarantees
:: for your use of it. csimmons.net, LLC is not responsible for any damage
:: or pain the use of this product may cause you. Please give credit if
:: you use this or create a derivative work.
:: =================== COPYRIGHT =========================================
:: =================== CONFIG ============================================
:: Path of the dir containing your repos [Note Trailing slash]
SET repodir=F:\Repositories\
:: Path of the dir in which to create you hotcopies [Note Trailing slash]
SET repodirhot=f:\druidBACKUP\SVN\
:: Path for log file [Note Trailing slash]
SET logdir=f:\druidBACKUP\SVN\
:: Path for svnadmin [Note Trailing slash]
::SET svnpath=C:\PROGRA~2\VISUAL~1\bin\svnadmin.exe
:: User mode - 1=Interactive | 0=NonInteractive
SET imode=1
:: =================== CONFIG ============================================
:: =================== SCRIPT ============================================
:: !!! NO NEED TO EDIT BEYOND THIS POINT !!!
:: Make a date_time stamp like 030902_134200
SET hh=%time:~0,2%
:: Add a zero when this is run before 10 am.
IF "%time:~0,1%"==" " set hh=0%hh:~1,1%
SET yymmdd_hhmmss=%date:~12,2%%date:~4,2%%date:~7,2%_%hh%%time:~3,2%%time:~6,2%
:: Make a name for the log file
SET repolog=%logdir%%yymmdd_hhmmss%repobackup.log
:: Start log
ECHO START %date% %time% >> %repolog%
:: IF a hotcopy exists delete it first ELSE
:: Create directories and svn hotcopy repos to them
FOR /F %%G IN ('dir /b /ad %repodir%') DO ^
IF EXIST %repodirhot%%%G (rmdir /S /Q %repodirhot%%%G & mkdir %repodirhot%%%G >> %repolog% & ^
ECHO Starting SVN backup for %%G... >> %repolog% & ^
C:\PROGRA~2\VISUAL~1\bin\svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^
IF %imode%== 1 ECHO FINISHED...%%G) ^
ELSE (mkdir %repodirhot%%%G >> %repolog% & ^
ECHO Starting SVN backup for %%G... >> %repolog% & ^
C:\PROGRA~2\VISUAL~1\bin\svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^
IF %imode%== 1 ECHO FINISHED...%%G)
:: Finish log
ECHO END %date% %time% >> %repolog%
:: Display log message if interactive mode otherwise EXIT
ECHO Done... Logs available here: %repolog%
if %imode%== 1 pause
:: =================== SCRIPT ============================================
EXIT
The idea is to launch a larger script myScript.cmd witch are doing the hotcopy of
my repository. This is working if i manually start the post-commit.cmd
reading the manual here visualsvn.com
I cannot understand what to practically do regarding this text below.
"Subversion executes hooks as the same user who owns the process that is accessing the Subversion repository. In most cases, the repository is being accessed via a Subversion server, so this user is the same user as whom the server runs on the system. The hooks themselves will need to be configured with OS-level permissions that allow that user to execute them. Also, this means that any programs or files (including the Subversion repository) accessed directly or indirectly by the hook will be accessed as the same user. In other words, be alert to potential permission-related problems that could prevent the hook from performing the tasks it is designed to perform."
UPDATE
VisualSVN Server service runs under Network Service
account by
default or under dedicated custom account (should be created
manually).
Subversion hooks are executed under the VisualSVN Server service
account (Network Service
or dedicated account)
If the hook script works properly when you start it manually, I advise you to check the permissions for the service account. It should have access to 'C:\PROGRA~2\VISUAL~1\bin\myScript.cmd' and all other files involved.
Please also note that before Subversion calls a hook script, it removes all variables -- including %PATH% on Windows -- from the environment. Therefore, your script can only run another program if you spell out that program's absolute name.