Mailing List Archive

Hooks on Windows
Hi Together

The basic part of the hooks works I tested before, it works.

I try to use the trac-post-commit-hook on Windows but I can't see references
in my tickets:-(

My script looks like the following.


Set REPOS=%1
set TXN=%2
Set TRAC_ENV="C:\Programme\xampp\htdocs\test\Envoirment\"
Set LOG="C:\Programme\Subversion\bin\svnlook.exe log -t %TXN% %REPOS%"
C:\Python23\python.exe C:\projects\test\hooks\trac-pre-commit-hook.py
"%TRAC_ENV%" "%Log%"



The Content of the Variables are:

REPOS C:\projects\test
TXN "17"
Env "C:\Programme\xampp\htdocs\test\Envoirment\"



Someone have an idea wy this not work. How I can debug the
trac-post-commit-hook on Windows?


Thanks in Advance.

Regards Ivo
Hooks on Windows [ In reply to ]
Ivo Looser <ivo.looser@login.ch> [2004-06-21/00:07]:
> I try to use the trac-post-commit-hook on Windows but I can't see
> references in my tickets:-(
[...]
> Set REPOS=%1
> set TXN=%2
> Set TRAC_ENV="C:\Programme\xampp\htdocs\test\Envoirment\"
^^^^^^^^^^
> Set LOG="C:\Programme\Subversion\bin\svnlook.exe log -t %TXN% %REPOS%"
^ ^
> C:\Python23\python.exe C:\projects\test\hooks\trac-pre-commit-hook.py
> "%TRAC_ENV%" "%Log%"

Zero Trac on Windows experience here, but:
1) Is that really supposed to spell `Envoirment', not `Environment'?
2) Check the usage in the pre-commit-hook script:

| # This script should be invoked from the subversion pre-commit hook like this:
| #
| # REPOS="$1"
| # TXN="$2"
| # TRAC_ENV="/somewhere/trac/project/"
| # LOG=`/usr/bin/svnlook log -t "$TXN" "$REPOS"`
| # /usr/bin/python /some/path/trac-pre-commit-hook "$TRAC_ENV" "$LOG" || exit 1
[...]

Note the backticks (`) around the svnlook invocation: VAR=`somecommand`
is not the same as VAR="somestring". Backticks are used in unix shell
scripts to read the output of a command into a variable (or directly use
it in other ways).

It has been a while since I've touched a DOS batch file, but as far as I
remember, the only way to do something like backticks in batch is via
ugly temporary file tricks. You might be better off using cygwin bash,
or python, since you already have that installed anyway.

Also, note the `|| exit 1' -- the hook script itself should exit with 1
if the trac-pre-commit-hook script fails (ie. terminates with a non-zero
exit status). I have no idea how to accomplish this in batch.

Cheers,
Dan

--
Daniel Roethlisberger <daniel@roe.ch>
GnuPG key ID 0x804A06B1 (DSA/ElGamal)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : /archive/trac/attachments/20040621/f81fa4d6/attachment.pgp