Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to require commit messages in VisualSVN server?

We've got VisualSVN Server set up as our Subversion server on Windows, and we use Ankhsvn + TortoiseSVN as clients on our workstations.

How can you configure the server to require commit messages to be non-empty?

like image 830
Ben Collins Avatar asked Oct 29 '08 18:10

Ben Collins


People also ask

What is pre-commit hook in svn?

A pre-commit hook is a feature available in the Subversion version control system that allows code to be validated before it is committed to the repository. The PHP_CodeSniffer pre-commit hook allows you to check code for coding standard errors and stop the commit process if errors are found.

What port does VisualSVN Server use?

Server port This setting allows you to configure VisualSVN Server to use a specific TCP port. By default the server uses port 443 for HTTPS and port 80 for HTTP. If the default ports are occupied by other applications, it is suggested to use the 8443 and 8080 ports instead.


1 Answers

I'm glad you asked this question. This is our pre-commit hook script written in common Windows Batch. It denies commit if the log message is less than 6 characters. Just put the pre-commit.bat to your hooks directory.

pre-commit.bat

setlocal enabledelayedexpansion  set REPOS=%1 set TXN=%2  set SVNLOOK="%VISUALSVN_SERVER%\bin\svnlook.exe"  SET M=  REM Concatenate all the lines in the commit message FOR /F "usebackq delims==" %%g IN (`%SVNLOOK% log -t %TXN% %REPOS%`) DO SET M=!M!%%g  REM Make sure M is defined SET M=0%M%  REM Here the 6 is the length we require IF NOT "%M:~6,1%"=="" goto NORMAL_EXIT  :ERROR_TOO_SHORT 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 
like image 84
sylvanaar Avatar answered Sep 29 '22 14:09

sylvanaar