There has been a time where I feel so frustrated on my team member who never put any comment on their code end up giving me a hard time to trace back their code. And feel so stupid that digging down each revision changes to open up each file to verify and review their code. But I do not have such luxury time for me to do this setup. Until this week, the UAT is sign-off, I take up the opportunity to continue my work.
There is a template code with a filename, pre-commit.tmpl is ready for use locate inside the directory
@echo off
:: Stops commits that don't include a log message of at least 6 characters.
@echo off
setlocal
rem Subversion sends through the repository path and transaction id
set REPOS=%1
set TXN=%2
svnlook log %REPOS% -t %TXN% | findstr ...... > nul
if %errorlevel% gtr 0 (goto err) else exit 0
:err
echo --------------------------------------------------------------------------- 1>&2
echo Your commit has been blocked because it didn't include a log message. 1>&2
echo Do the commit again, this time with a log message that describes your changes. 1>&2
echo --------------------------------------------------------------------------- 1>&2
exit 1
There are few thing I need to take note of:- The pre-commit file must be saved as bat or exe file extension.
- The pre-commit file must locate under the
/hooks directory. - Remember to restart the svn server service when done these changes.
No comments:
Post a Comment