[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: Gustavo Guerra <gustavguerra_at_gmail.com>
Date: 2006-03-05 04:06:39 CET

The problem isn't the paths, the second check for the string "Autoversioning"
in the message works.

Gustavo Guerra

> 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 04:08:58 2006

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