|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-05-25 12:56 UTC] nirav at mehtanirav dot com
Description: ------------ svn_mkdir returns true, but does not create a directory in the local repository. Tested only with local repository using file:/// on Mac OS X. Command line SVN client works without a problem. Pasting an excerpt below. Essentially, I try and see if my target directory exists. If it does not, it means it's not even in repository (in my case). So I create a new directory for it. Right after that, I try to checkout the newly created directory. These steps work fine if done from command line. Doing them from PHP returns true on svn_mkdir, but gives warning and fails. I recompiled the PECL extension with svn_client_mkdir3 (based on http://svn.collab.net/svn-doxygen/group__Mkdir.html), since I have SVN 1.5, but that too did not work. Reproduce code: --------------- if (!is_dir($this->docFolder)) { $newFile = true; //TODO: Does svn_mkdir require a commit? What to commit then? if (true !== svn_mkdir($this->svnDocFolder)) { echo "Error creating SVN Folder"; return false; } } if (!is_dir($this->docFolder. '/.svn')) { $newFile = true; svn_checkout($this->svnDocFolder, $this->docFolder); } Expected result: ---------------- Expected that svn_checkout will work, and "svn list file:///repo/location" would show the newly created folder. Actual result: -------------- Warning: svn_checkout() [function.svn-checkout]: svn error(s) occured 170000 (Bad URL passed to RA layer) URL 'file:///Users/niravmehta/Projects/revisionTracking/docsrepo/1381' doesn't exist in /Users/niravmehta/Projects/Name/classes/SVNDocument.php on line 120 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 13:00:01 2025 UTC |
While they work on fixing this, here's an alternate that could get your job done. This function requires svn command line executable, and permission to exec(). function svn_mkdir2($url) { $out = array(); $ret_var = null; $cmd = '/usr/bin/svn mkdir --non-interactive -m \'Creating new directory\' '.$url.' 2>&1'; exec($cmd, $out, $ret_var); if($ret_var > 0) { echo 'Error creating new directory '.$url.': '.join(' ', $out); return false; } return true; }