[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Checking for empty messages on pre-commit hook on windows

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-03-05 01:42:07 CET

On Mar 5, 2006, at 00:36, Gustavo Guerra wrote:

> I've put both ways in the commit hook, and it still doesn't work.
> Any clues?

Does that work when you run it manually from the command line? I
don't know Windows, but I'm having a hard time seeing how it would
know where svnlook, grep and python are located, since you haven't
specified absolute paths to them, which it's usually advisable that
you do, since the hook runs without the usual environment variables
you have in a shell.

> setlocal
>
> set REPOS=%1 set TXN=%2 set SVNLOOK=svnlook
> set GREP=grep
> set PYTHON=python
>
> c:
> cd \SVNRoot\obiwan\hooks
>
> set repos=%1
> set txn=%2
>
> %SVNLOOK% log -t %TXN% %REPOS% | %GREP% -qF "^$" temp.xpto
> if '%errorlevel%'=='1' goto EMPTY_CHECK2
> echo Empty commit messages are not allowed >&2
> goto ERROR
>
> :EMPTY_CHECK2
> set COMMIT_LOG_IS_EMPTY=true
> for /f "tokens=*" %%i in ('%SVNLOOK% log -t %TXN% %REPOS% ') do set
> COMMIT_LOG_IS_EMPTY=false
> if '%COMMIT_LOG_IS_EMPTY%'=='false' goto AUTOVERSIONING_CHECK
> echo Empty commit messages are not allowed >&2
> goto ERROR
>
> :AUTOVERSIONING_CHECK
> %SVNLOOK% log -t %TXN% %REPOS% | %GREP% -qF "Autoversioning" temp.xpto
> if '%errorlevel%'=='1' goto CHECK_CASE_INSENSITIVE
> echo Autoversioning commit messages are not allowed >&2
> goto ERROR
>
> :CHECK_CASE_INSENSITIVE
> %PYTHON% check-case-insensitive.py %REPOS% %TXN%
> if '%errorlevel%'=='1' goto ERROR
>
> %PYTHON% remove-trailing-newlines.py -t %TXN% %REPOS%
> if '%errorlevel%'=='1' goto ERROR
>
> exit /b 0
>
> :ERROR
> rem > pre-commit-messages.vbs echo WScript.Echo^( "Error found in
> commit." ^& vbCrLf ^& "Please check." ^) rem wscript pre-commit-
> messages.vbs rem del pre-commit-messages.vbs exit /b 1

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Mar 5 01:43:40 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.