Edgewall Software

Ticket #1602: post-commit.cmd

File post-commit.cmd, 2.1 KB (added by coreywangler@…, 3 years ago)

fixed .com file for launching the corresponding python hook script (from 0.8-stable/contrib/) in windows

Line 
1@ECHO OFF
2SET REPOS=%1
3SET TXN=%2
4
5SET SVNREP_DIR=C:\svnrep\___SVN_REPOSITORY_NAME_HERE___
6SET TRACDB_DIR=C:\tracdb\______TRAC_DB_NAME_HERE______
7
8SET PYTHON_DIR=C:\Python23
9SET SVN_DIR=C:\Program Files\Subversion
10
11REM POST-COMMIT HOOK (for a Windows CMD.exe interpreter)
12REM
13REM The post-commit hook is invoked after a commit.  Subversion runs
14REM this hook by invoking a program (script, executable, binary, etc.)
15REM named 'post-commit' (for which this file is a template) with the
16REM following ordered arguments:
17REM
18REM   [1] REPOS-PATH   (the path to this repository)
19REM   [2] REV          (the number of the revision just committed)
20REM
21REM The default working directory for the invocation is undefined, so
22REM the program should set one explicitly if it cares.
23REM
24REM Because the commit has already completed and cannot be undone,
25REM the exit code of the hook program is ignored.  The hook program
26REM can use the 'svnlook' utility to help it examine the
27REM newly-committed tree.
28REM
29REM On a Unix system, the normal procedure is to have 'post-commit'
30REM invoke other programs to do the real work, though it may do the
31REM work itself too.
32REM
33REM Note that 'post-commit' must be executable by the user(s) who will
34REM invoke it (typically the user httpd runs as), and that user must
35REM have filesystem-level permission to access the repository.
36REM
37REM On a Windows system, you should name the hook program
38REM 'post-commit.bat' or 'post-commit.exe',
39REM but the basic idea is the same.
40REM
41REM Here is an example hook script, for a Windows CMD.exe interpreter:
42
43SET HOOKS_DIR="%SVNREP_DIR%\hooks"
44REM SET TRAC_ENV="%TRACDB_DIR%\db\trac.db"
45SET TRAC_ENV="%TRACDB_DIR%"
46
47SET PYTHON="%PYTHON_DIR%\python.exe"
48SET SVN="%SVN_DIR%\bin\svn.exe"
49SET SVNADMIN="%SVN_DIR%\bin\svnadmin.exe"
50SET SVNLOOK="%SVN_DIR%\bin\svnlook.exe"
51
52FOR /F "usebackq delims==" %%i IN (`%%SVNLOOK%% log -r %TXN% %REPOS%`) DO SET LOG=%%i
53FOR /F "usebackq delims==" %%i IN (`%%SVNLOOK%% author -r %TXN% %REPOS%`) DO SET AUTHOR=%%i
54
55%PYTHON% "%HOOKS_DIR%\trac-post-commit-hook" -p "%TRAC_ENV%" -r "%TXN%" -u "%AUTHOR%" -m "%LOG%"