/** * List repository content at a given revision * * @access public * @author Cédric Alfonsi, <*****@*****.**> * @param Repository vcs * @param string path * @param int revision * @return array */ public function listContent(core_kernel_versioning_Repository $vcs, $path, $revision = null) { $returnValue = array(); $startTime = helpers_Time::getMicroTime(); if ($vcs->authenticate()) { $svnList = svn_ls($path, $revision); foreach ($svnList as $svnEntry) { $returnValue[] = array('name' => $svnEntry['name'], 'type' => $svnEntry['type'], 'revision' => $svnEntry['created_rev'], 'author' => $svnEntry['last_author'], 'time' => $svnEntry['time_t']); } } $endTime = helpers_Time::getMicroTime(); common_Logger::i("svn_listContent (" . $path . ') -> ' . ($endTime - $startTime) . 's'); return (array) $returnValue; }
/** * Retrieve given version of a file from a path * * @access public * @author Cédric Alfonsi, <*****@*****.**> * @param File resource * @param string path * @param string version * @return boolean */ public function resolve(core_kernel_file_File $resource, $path, $version) { $returnValue = (bool) false; $startTime = helpers_Time::getMicroTime(); $listParentFolder = helpers_File::scandir(dirname($path)); return core_kernel_versioning_subversionWindows_File::singleton()->resolve($resource, $path, $version); var_dump('resolving'); switch ($version) { case VERSIONING_FILE_VERSION_MINE: //use our version of the file before the update we made the conflict $resource->setContent(file_get_contents($path . '.mine')); //delete the noisy files (mine, r***) var_dump($listParentFolder, $path, preg_quote($path), '@^' . preg_quote($path) . '\\.@'); foreach ($listParentFolder as $file) { if (preg_match('@^' . preg_quote($path) . '\\.@', $file)) { var_dump('deleted noisy file ' . $path); unlink($file); } } $returnValue = true; break; case VERSIONING_FILE_VERSION_THEIRS: //use the incoming version of the file if ($resource->revert() && $resource->update()) { $returnValue = true; } break; case VERSIONING_FILE_VERSION_WORKING: //nothing to do, we keep the current version of the file $returnValue = true; break; default: //@todo change with invalid argument exception throw new common_Exception('invalid argument version'); } //$returnValue = core_kernel_versioning_subversionWindows_File::singleton()->resolve($resource, $path, $version); $endTime = helpers_Time::getMicroTime(); common_Logger::i("svn_resolve ('.{$path}.' : '.{$version}.') -> " . ($endTime - $startTime) . 's'); return (bool) $returnValue; }