[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery { 4 5 public function getFileContentFuture() { 6 $drequest = $this->getRequest(); 7 8 $repository = $drequest->getRepository(); 9 $path = $drequest->getPath(); 10 $commit = $drequest->getCommit(); 11 12 return $repository->getRemoteCommandFuture( 13 '%C %s', 14 $this->getNeedsBlame() ? 'blame --force' : 'cat', 15 $repository->getSubversionPathURI($path, $commit)); 16 } 17 18 protected function executeQueryFromFuture(Future $future) { 19 try { 20 list($corpus) = $future->resolvex(); 21 } catch (CommandException $ex) { 22 $stderr = $ex->getStdErr(); 23 if (preg_match('/path not found$/', trim($stderr))) { 24 // TODO: Improve user experience for this. One way to end up here 25 // is to have the parser behind and look at a file which was recently 26 // nuked; Diffusion will think it still exists and try to grab content 27 // at HEAD. 28 throw new Exception( 29 'Failed to retrieve file content from Subversion. The file may '. 30 'have been recently deleted, or the Diffusion cache may be out of '. 31 'date.'); 32 } else { 33 throw $ex; 34 } 35 } 36 37 $file_content = new DiffusionFileContent(); 38 $file_content->setCorpus($corpus); 39 40 return $file_content; 41 } 42 43 protected function tokenizeLine($line) { 44 // sample line: 45 // 347498 yliu function print(); 46 $m = array(); 47 preg_match('/^\s*(\d+)\s+(\S+)(?: (.*))?$/', $line, $m); 48 $rev_id = $m[1]; 49 $author = $m[2]; 50 $text = idx($m, 3); 51 52 return array($rev_id, $author, $text); 53 } 54 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |