Subversion post commit script to blog blank log messages on Windows
I was looking for a script that would force people to log a message when committing files to a Subversion repository. I was unsuccessful getting the information out of Google, so I asked on the Subversion mailing list, and found someone that had written one.
Nathan Kidd was kind enough to send me this script:
@echo off
:: Stops commits that have empty log messages.
setlocal
set “REPOS=%~1″
set “TXN=%~2″
:: Make sure that the log message contains some text.
for /f “tokens=*” %%i in (’C:Progra~1SubversioninSvnlook.exe log -t “%TXN%” “%REPOS%”‘) do set “LOGMSG=%%i”
if not “%LOGMSG%”==”" exit 0
echo. 1>&2
echo Your commit has been cancelled because you didn’t enter a log message! 1>&2
echo Please write a brief log message giving an overview of the changes 1>&2
echo that you are checking in.
exit 1
All you have to do is put this in a file called “pre-commit.cmd”, and put it in your hooks folder. You’ll also have to change the path to Svnlook.exe if you have it in a different location.