Zen's Blog » SVN Windows: allow edit of commit logs

SVN Windows: allow edit of commit logs January 16, 2010at00:34

By default, SVN does not allow you to change commit messages. To enable that some times good some times bad feature, create a file named pre-revprop-change.bat and place it in the /repos/hooks folder of your svn central repo installation.

 Winbatch | 
 
 copy code |
?

01
@ECHO OFF
02
:: Set all parameters. Even though most are not used, in case you want to add
03
:: changes that allow, for example, editing of the author or addition of log messages.
04
set repository=%1
05
set revision=%2
06
set userName=%3
07
set propertyName=%4
08
set action=%5
09
 
10
:: Only allow the log message to be changed, but not author, etc.
11
if /I not “%propertyName%” == “svn:log” goto ERROR_PROPNAME
12
 
13
:: Only allow modification of a log message, not addition or deletion.
14
if /I not “%action%” == “M” goto ERROR_ACTION
15
 
16
:: Make sure that the new svn:log message is not empty.
17
set bIsEmpty=true
18
for /f “tokens=*%%g in (‘find /V “”‘) do (
19
set bIsEmpty=false
20
)
21
if%bIsEmpty%” == “truegoto ERROR_EMPTY
22
 
23
goto :eof
24
 
25
:ERROR_EMPTY
26
echo Empty svn:log messages are not allowed. >&2
27
goto ERROR_EXIT
28
 
29
:ERROR_PROPNAME
30
echo Only changes to svn:log messages are allowed. >&2
31
goto ERROR_EXIT
32
 
33
:ERROR_ACTION
34
echo Only modifications to svn:log revision properties are allowed. >&2
35
goto ERROR_EXIT
36
 
37
:ERROR_EXIT
38
exit /b 1

Leave a Reply