I need to create a web app which works with SVN command line. So I want to use a exec command with svn commit and a variable contains the path of the working copy. I tried this code but didn't work. Commit didn't take place.
<?php
$lpath="c:\a\svn\projectwc";
$msg="first commit";
exec("svn commit -m $msg $lpath");
?>
And yeah I added all the files inside already. I tried by replacing the lpath with path value and it worked. Please help...
Your string expands to
svn commit -m first commit c:\a\svn\projectwc
Whereas you need to do
svn commit -m "first commit" c:\a\svn\projectwc
As the log message is more than one word it needs to be in quotes.
I think you should re-think what you are trying to achieve here. Constructing strings based on user input and passing them to exec
is a very bad idea from a security perspective.
Also you tagged the post tortoise-svn - if you invoke TSVN from the command line it pops up the GUI which is definitely not appropriate server side.
Then you've got other considerations like:
Whatever you are trying to do, it's probable there is some free software out there that does it already. svn has a webdav interface and an API implemented in many languages - this would be far safer than using exec