1

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 ?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Well, I've been wondering about something similar to 2nd solution but it is still ugly hack. For now, let's wait for more answers. Thanks anyway, btw. I use linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.