You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Roberto <sm...@gmail.com> on 2009/01/06 20:04:56 UTC

customizations if svn source-code

Hi all,
 I'm creating an application where show logs the "svn checkout" and "svn
update" project via web (transcript to html).
In linux terminal when i download my project with "svn checkout" it shows:

A    cp/language/mail/index.php
A    cp/language/Portugues.php
A    cp/language/Deutsch.php
A    cp/language/Nederlands.php
A    cp/language/Italiano.php
A    cp/language/Espanol.php
A    cp/language/language.php
A    cp/language/Francais.php
A    cp/language/index.php

And via Web its shows:

A    cp/language/mail/index.phpA    cp/language/Portuguese.phpA
cp/language/Deutsch.phpA    cp/language/Nederlands.phpA
cp/language/Italian.phpA    cp/languageEspanol.phpA
cp/language/language.phpA    cp/language/Francais.phpA
cp/language/index.php


Where can I change in the source code of subversion to add the "<br />" html
tag to skip lines?

Thanks

Re: customizations if svn source-code

Posted by Roberto <sm...@gmail.com>.
Ryan Schmidt, Jan Hendrik,

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

2009/1/6 Ryan Schmidt <su...@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.
>
>
>

Re: customizations if svn source-code

Posted by Ryan Schmidt <su...@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.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1008512

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: customizations if svn source-code

Posted by Jan Hendrik <li...@gmail.com>.
Concerning Re: customizations if svn source-co
Andy Levy wrote on 6 Jan 2009, 16:07, at least in part:

> Please keep your replies on-list.
> 
> On Tue, Jan 6, 2009 at 16:03, Roberto Lima <sm...@gmail.com> 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 />

nl2br

Note that as of PHP 5.3.0 it will take a second parameter ("false") 
to make it valid HTML (<br>); the default - and current behaviour - 
is XHTML (<br />).

Jan Hendrik

---------------------------------------
Freedom quote:

     America has believed that in differentiation, not in uniformity,
     lies the path of progress. It acted on this belief, it has advanced
     human happiness, and it has prospered.
               -- Louis D. Brandeis
                  U.S. Supreme Court Justice, 1856-1941

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1009647

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: customizations if svn source-code

Posted by Andy Levy <an...@gmail.com>.
Please keep your replies on-list.

On Tue, Jan 6, 2009 at 16:03, Roberto Lima <sm...@gmail.com> 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 />

> 2009/1/6 Andy Levy <an...@gmail.com>
>>
>> On Tue, Jan 6, 2009 at 15:04, Roberto <sm...@gmail.com> wrote:
>> > Hi all,
>> >  I'm creating an application where show logs the "svn checkout" and "svn
>> > update" project via web (transcript to html).
>> > In linux terminal when i download my project with "svn checkout" it
>> > shows:
>> >
>> > A    cp/language/mail/index.php
>> > A    cp/language/Portugues.php
>> > A    cp/language/Deutsch.php
>> > A    cp/language/Nederlands.php
>> > A    cp/language/Italiano.php
>> > A    cp/language/Espanol.php
>> > A    cp/language/language.php
>> > A    cp/language/Francais.php
>> > A    cp/language/index.php
>> >
>> > And via Web its shows:
>> >
>> > A    cp/language/mail/index.phpA    cp/language/Portuguese.phpA
>> > cp/language/Deutsch.phpA    cp/language/Nederlands.phpA
>> > cp/language/Italian.phpA    cp/languageEspanol.phpA
>> > cp/language/language.phpA    cp/language/Francais.phpA
>> > cp/language/index.php
>> >
>> >
>> > Where can I change in the source code of subversion to add the "<br />"
>> > html
>> > tag to skip lines?
>>
>> Don't change the source code of Subversion. Change whatever is
>> recording/processing the transcript to change newlines to <br />. It's
>> a pretty simple regular expression.
>
>

Re: customizations if svn source-code

Posted by Andy Levy <an...@gmail.com>.
On Tue, Jan 6, 2009 at 15:04, Roberto <sm...@gmail.com> wrote:
> Hi all,
>  I'm creating an application where show logs the "svn checkout" and "svn
> update" project via web (transcript to html).
> In linux terminal when i download my project with "svn checkout" it shows:
>
> A    cp/language/mail/index.php
> A    cp/language/Portugues.php
> A    cp/language/Deutsch.php
> A    cp/language/Nederlands.php
> A    cp/language/Italiano.php
> A    cp/language/Espanol.php
> A    cp/language/language.php
> A    cp/language/Francais.php
> A    cp/language/index.php
>
> And via Web its shows:
>
> A    cp/language/mail/index.phpA    cp/language/Portuguese.phpA
> cp/language/Deutsch.phpA    cp/language/Nederlands.phpA
> cp/language/Italian.phpA    cp/languageEspanol.phpA
> cp/language/language.phpA    cp/language/Francais.phpA
> cp/language/index.php
>
>
> Where can I change in the source code of subversion to add the "<br />" html
> tag to skip lines?

Don't change the source code of Subversion. Change whatever is
recording/processing the transcript to change newlines to <br />. It's
a pretty simple regular expression.