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

Re: svnlook log doesn't return message

From: Ryan Schmidt <subversion-2008a_at_ryandesign.com>
Date: Fri, 29 Feb 2008 03:48:07 -0600

On Feb 29, 2008, at 03:39, Ryan Schmidt wrote:

> On Feb 29, 2008, at 03:12, matthieu.mary_at_externe.bnpparibas.com wrote:
>
>> /**
>> * check if we have a message in transaction
>> */
>> if (__CONTROL_COMMIT_MESSAGE__)
>> {
>> /**
>> * This command run "C:\svn\bin\svnlook.exe" log -
>> t 1-1 D:\repositories/myproject
>> */
>> $cmd = trim(exec(escapeshellarg
>> (__SVN_LOOK_PATH__)." log -t ".__TXN__." ".__REPOS__));
>> if (!preg_match("/[a-zA-Z0-9]+/", $cmd, $matches))
>> {
>> Error :: Display("You should set a message
>> in your commit", __ERROR_CODE_LOG_MESSAGE_EMPTY__);
>> }
>>
>> }

[snip]

> $output = array();
> $cmd = trim(exec(escapeshellarg(__SVN_LOOK_PATH__)." log -t
> ".__TXN__." ".__REPOS__."2>&1", $output, $returnVar));
>
> $cmd is just going to contain the last line of output, while implode
> ("\n", $output) will be all lines of output (you never know, the
> error output may be more than one line...).

[snip]

And of course right after I sent my reply, I thought a bit more about
the problem and realized that because you're using the return value
from exec(), which is just the last line of output, you're only
checking the last line of the log message. If you have a nice long
log message but it ends with a blank line (for example if it was
composed in an editor like mine which always makes sure that every
saved file ends with a blank line), your script will think you
entered no log message, and will issue an error. You should be
checking the entire output of svnlook log, not just the last line.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-02-29 10:48:52 CET

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