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

Re: customizations if svn source-code

From: Roberto <smuxbr_at_gmail.com>
Date: Wed, 7 Jan 2009 10:16:10 -0400

Ryan Schmidt, Jan Hendrik,

Thanks for this information, this example works fine with me.

2009/1/6 Ryan Schmidt <subversion-2009a_at_ryandesign.com>

>
> On Jan 6, 2009, at 15:07, Andy Levy wrote:
>
> On Tue, Jan 6, 2009 at 16:03, Roberto Lima wrote:
>>
>> Ok, can you tell me how do I get the stdout of svn in php with regular
>>> expression and return to me?
>>>
>>
>> I'm not a PHP programmer.
>>
>> You may not even need a full regular expression, just use a string
>> replace function to replace \n with <br />
>>
>
> The php function for that task is called nl2br(). For output to a web page,
> you will also want to run htmlspecialchars() over the plain text. For
> example, you might want:
>
>
> <?php
>
> $cmd = 'svn update /path/to/workingcopy --non-interactive 2>&1';
> $output = array();
> $error_code = 0;
> exec($cmd, $output, $error_code);
> if ($error_code) {
> echo "Error $error_code occurred<br />\n";
> }
> echo nl2br(htmlspecialchars(implode("\n", $output))) . "\n";
>
> ?>
>
>
> Note that this will not produce any output until after the svn command is
> completely done running. If you're trying to use this as a progress display,
> and you want to see the filenames output as Subversion is updating them,
> you'll need to use proc_open(), a much more complicated method of
> interacting with processes.
>
> http://php.net/proc-open
>
>
> You should probably ask any further php questions in a php support forum
> and not here.
>
>
>
Received on 2009-01-07 16:59:02 CET

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.