Reputation: 4138
In the svn repository/hooks
directory i have a pre-commit
script. For now, in the same directory I have also script.py
that is triggered by pre-commit
.
In above scenario, my script.py
is not under version control. That makes sense if I can't trust my users. However, in my case, I can trust my users and for maintenance purposes I would like to keep script.py
under version control (same repo).
The question is: how to trigger my script: trunk/tools/script.py
from repository/hooks/pre-commit
script ?
Upvotes: 1
Views: 156
Reputation: 2671
I see 2 possible solutions (not ideal, though):
a) Checkout trunk/tools
to repository/hooks
and write small trampoline:
(not real code, only idea!)
svn up tools
python -file tools/script.py %1 %2 %2
exit /b %ERRORLEVEL%
b) Cat trunk/tools/script.py to temp file and execute it. (again, idea only, I do not check that arguments passed correctly ...)
set TMPFILE=%TEMP%\%RANDOM%.py
svnlook cat %1 -r %2 trunk/tools/script.py > %TMPFILE%
python -file %TMPFILE% %1 %2 %2
exit /b %ERRORLEVEL%
P.S. You do not specify OS, so I assume it is Windows.
Upvotes: 1