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