SVN Pre commit check for short comments

Use this to stop developers and designers from committing changes to SVN without comments.

What is SVN?

SVN is an abbreviation for Subversion which is an Apache open source software versioning and revision control system. SVN is used to maintain current and historical versions of files such as source code, web pages, and documentation.

How to stop commits to SVN without comments

setlocal
 
set REPOS=%1
set TXN=%2
 
set SVNLOOK="C:\Program Files (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. 1>&2
echo Your commit has been blocked because your message was less than 6 characters 1>&2
echo Please write a message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
 
rem echo "Commit note must be at least 6 letters" >&2
goto ERROR_EXIT
 
:ERROR_EXIT
exit /b 1
 
REM All checks passed, so allow the commit.
:NORMAL_EXIT
exit 0

How to use this script?

Find the SVN installation folder and look for a folder called:

/hooks/

Then add the script above to the file in folder:

/hooks/pre-commit.bat

A word of advice

Do not use SVN… Use GIT.

What is GIT?

Git is a very fast distributed software versioning and revision control system which means it is not dependent on network access or a central server. Developers use GIT to maintain current and historical versions of files such as source code, web pages, and documentation. It is distributed under an open source license and was initially created by Linus Torvalds (the founder of Linux).



Comments

No comments yet.

Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

Robert

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning hands down.