VisualSVN Server - Enforce Comments

Pre-commit.hook 

setlocal

set REPOS=%1
set TXN=%2
set SVNLOOK="%PROGRAMFILES(X86)%\VisualSVN Server\bin\svnlook.exe"

REM Make sure that the log message contains some text.
FOR /F "usebackq delims==" %%g IN (`%SVNLOOK% log -t %TXN% %REPOS% FINDSTR /R /C:......`) DO goto NORMAL_EXIT

:ERROR_TOO_SHORT
echo "Must provide comments" >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

REM All checks passed, so allow the commit.
:NORMAL_EXIT
exit 0

2012-01-03: Post on StackOverflow on this: http://stackoverflow.com/questions/247888/how-to-require-commit-messages-in-visualsvn-server

2 Comments

  • Another method (w/Tortoise SVN, which if your team uses Visual SVN plug-in, you're golden): on the main folder, right-click -> Tortoise SVN -> Properties -> New. Use the "tsvn:logminsize" property, and set it to 5 or something. OK all the dialogs and commit the change.

    Then, in Tortoise SVN, it won't enable the OK button on the commit dialog until you fill in at least 5 characters.

  • @Darrell,
    Team is using something else. But I'll look into this option, thank you for letting me know.

Comments have been disabled for this content.