12,13d11
< # LINUX:
< #
20,46d17
< # WINDOWS: sample of pre-commit.bat (must use temporary files for the log message)
< #
< ##SET REPOS=%1
< ##SET TXN=%2
< ##
< ##::-----------------------------
< ##::Call the TRAC pre-commit hook
< ##::
< ##SET TRAC_ENV=C:\somewhere\trac\project
< ##SET LOG_FILE=%TEMP%.\svnfileT-%TXN%
< ##
< ##svnlook log -t %TXN% %REPOS%>%LOG_FILE%
< ##
< ##python [trac-path]\contrib\trac-pre-commit-hook "%TRAC_ENV%" "file:%LOG_FILE%"
< ##IF ERRORLEVEL 1 SET TRAC_CANCEL=YES
< ##DEL %LOG_FILE%
< ##IF DEFINED TRAC_CANCEL GOTO :ERROR
< ##::
< ##::-----------------------------
< ##
< ##:SUCCESS
< ##EXIT 0
< ##
< ##:ERROR
< ##EXIT 1 
< ##
< 
59d29
<     log = _readFromFile( log )
85,98d54
< 
< def _readFromFile(message):
<     """ Ivan Melnychuk: SOLUTION FOR WINDOWS SYSTEMS:
<     Windows does not support returning values from script.
<     Therefore temporary files may be used to keep some information like commit message
<     If the 'message' starts with 'file:', and the file with indicated name exists, then read the text message from the file rather then using the text directly
<     Even though actual message also may start with such prefix, it is very unlikely that the file exists with such a name by accident
<     """
<     if message[:5] == 'file:' and os.path.exists( message[5:] ):
<         f = open( message[5:], 'r' )
<         message = f.read()
<         f.close()
<         return message
<     return message;

