| 1 | 32,33d31 |
|---|
| 2 | < # |
|---|
| 3 | < # LINUX: |
|---|
| 4 | 47,71d44 |
|---|
| 5 | < # WINDOWS: sample of post-commit.bat (must use temporary files for the log message) |
|---|
| 6 | < # |
|---|
| 7 | < ##SET REPOS=%1 |
|---|
| 8 | < ##SET REV=%2 |
|---|
| 9 | < ## |
|---|
| 10 | < ##::----------------------------- |
|---|
| 11 | < ##::Call the TRAC post-commit hook |
|---|
| 12 | < ##:: |
|---|
| 13 | < ##SET TRAC_ENV=C:\somewhere\trac\project |
|---|
| 14 | < ##SET LOG_FILE=%TEMP%.\svnfileR-%REV% |
|---|
| 15 | < ##SET AUT_FILE=%TEMP%.\svnfileA-%REV% |
|---|
| 16 | < ## |
|---|
| 17 | < ##svnlook log -r %REV% %REPOS%>%LOG_FILE% |
|---|
| 18 | < ##svnlook author -r %REV% %REPOS%>%AUT_FILE% |
|---|
| 19 | < ## |
|---|
| 20 | < ##:: SET THE AUTHOR FROM THE FILE. The file is expected to contain only one line with this value |
|---|
| 21 | < ##FOR /F %%A IN (%AUT_FILE%) DO SET AUTHOR=%%A |
|---|
| 22 | < ## |
|---|
| 23 | < ##python [trac-path]\contrib\trac-post-commit-hook.py -p "%TRAC_ENV%" -r "%REV%" -u "%AUTHOR%" -m "file:%LOG_FILE%" |
|---|
| 24 | < ##DEL %LOG_FILE% |
|---|
| 25 | < ##DEL %AUT_FILE% |
|---|
| 26 | < ##:: |
|---|
| 27 | < ##::----------------------------- |
|---|
| 28 | < ## |
|---|
| 29 | < # |
|---|
| 30 | 144d116 |
|---|
| 31 | < msg = self._readFromFile( msg ) |
|---|
| 32 | 181,194d152 |
|---|
| 33 | < def _readFromFile(self, message): |
|---|
| 34 | < """ Ivan Melnychuk: SOLUTION FOR WINDOWS SYSTEMS: |
|---|
| 35 | < Windows does not support returning values from script. |
|---|
| 36 | < Therefore temporary files may be used to keep some information like commit message |
|---|
| 37 | < 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 |
|---|
| 38 | < Even though actual message also may start with such prefix, it is very unlikely that the file exists with such a name by accident |
|---|
| 39 | < """ |
|---|
| 40 | < if message[:5] == 'file:' and os.path.exists( message[5:] ): |
|---|
| 41 | < f = open( message[5:], 'r' ) |
|---|
| 42 | < message = f.read() |
|---|
| 43 | < f.close() |
|---|
| 44 | < return message |
|---|
| 45 | < return message; |
|---|
| 46 | < |
|---|
| 47 | 202c160 |
|---|
| 48 | < |
|---|
| 49 | --- |
|---|
| 50 | > |
|---|
| 51 | 208c166 |
|---|
| 52 | < |
|---|
| 53 | --- |
|---|
| 54 | > |
|---|