Differential D14970 Diff 36173 src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php
| <?php | <?php | ||||
| final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery { | final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery { | ||||
| public function getFileContentFuture() { | protected function getFileContentFuture() { | ||||
| $drequest = $this->getRequest(); | $drequest = $this->getRequest(); | ||||
| $repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
| $path = $drequest->getPath(); | $path = $drequest->getPath(); | ||||
| $commit = $drequest->getCommit(); | $commit = $drequest->getCommit(); | ||||
| return $repository->getRemoteCommandFuture( | return $repository->getRemoteCommandFuture( | ||||
| 'cat %s', | 'cat %s', | ||||
| $repository->getSubversionPathURI($path, $commit)); | $repository->getSubversionPathURI($path, $commit)); | ||||
| } | } | ||||
| protected function executeQueryFromFuture(Future $future) { | protected function resolveFileContentFuture(Future $future) { | ||||
| try { | |||||
| list($corpus) = $future->resolvex(); | list($corpus) = $future->resolvex(); | ||||
| } catch (CommandException $ex) { | return $corpus; | ||||
| $stderr = $ex->getStdErr(); | |||||
| if (preg_match('/path not found$/', trim($stderr))) { | |||||
| // TODO: Improve user experience for this. One way to end up here | |||||
| // is to have the parser behind and look at a file which was recently | |||||
| // nuked; Diffusion will think it still exists and try to grab content | |||||
| // at HEAD. | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Failed to retrieve file content from Subversion. The file may '. | |||||
| 'have been recently deleted, or the Diffusion cache may be out of '. | |||||
| 'date.')); | |||||
| } else { | |||||
| throw $ex; | |||||
| } | |||||
| } | |||||
| $file_content = new DiffusionFileContent(); | |||||
| $file_content->setCorpus($corpus); | |||||
| return $file_content; | |||||
| } | } | ||||
| } | } | ||||