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

Re: Help a Brazilian Student...

From: Ryan Schmidt <subversion-2008b_at_ryandesign.com>
Date: Sat, 24 May 2008 15:32:11 -0500

On May 24, 2008, at 12:42, Kevin Grover wrote:

> On Fri, May 23, 2008 at 4:59 PM, Eduardo Gonçalves wrote:
>
>> I need to run the SVN through a PHP script.
>>
>> I am working on a Windows XP operating system and the IIS web server.
>>
>> The problem occurs when running the excerpt from source
>> illustrated below:
>>
>> "
>> echo "".exec("svn commit file:///D:/tcc/repository/project/")."";
>> echo "".exec("svn update file:///D:/tcc/repository/project/")."";
>> "
>> There is absolutely nothing in return. I do not know where I am
>> committing
>> errors. Did you know tell me?
>>
>> Other information: running these commands in the command line, I
>> get message
>> that the version of SVN installed on my computer is outdated to
>> run such
>> commands and it is requested that I update the version of SVN, but
>> the
>> version I have now is the most updated.
>
> First, you will be more likely to get responses if you use an
> applicable Subject line.
>
> Second, 'svn commit' and 'svn update' both apply to working copies,
> e.g. a local working directory created when you run 'svn checkout'.
> Your example makes it look like you're trying to apply them to a
> repository. Once checked out, the working copy knows the URL from
> which it was checked out: you don't specify it on the command line.
>
> You should run all your commands from the command line and verify that
> they really do what you want.

Right. You also need to be in the working copy for the commit or
update to work, or supply the working copy path as the argument to
the command. And the reason you're not seeing any output in PHP is
that you're not requesting to get the stderr output, which is where
errors will be printed. Also, exec only returns the last line of
output; you probably want all the output. Considering all these
things, I recommend something like:

<?php

$wcpath = '/path/to/workingcopy';
$cmd = 'svn update ' . escapeshellarg($wcpath) . ' 2>&1';
$output = array();
exec($cmd, $output, $error);
#if ($error != 0) {
        echo implode("\n", $output) . "\n";
#}

?>

Usually you would only need to look at the output in the case when
the return code is nonzero, but in the case of "svn update" with an
invalid path, it will say "Skipped '/path/to/workingcopy'" and will
still return 0. So I wanted to make sure you see such output.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-05-24 22:32:41 CEST

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.