protected function executeQueryFromFuture(Future $future) { list($corpus) = $future->resolvex(); $file_content = new DiffusionFileContent(); $file_content->setCorpus($corpus); return $file_content; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); $commit = $drequest->getCommit(); $remote_uri = $repository->getDetail('remote-uri'); try { list($corpus) = execx('svn --non-interactive %s %s%s@%s', $this->getNeedsBlame() ? 'blame' : 'cat', $remote_uri, $path, $commit); } catch (CommandException $ex) { $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("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; }
public final function loadFileContentFromFuture(Future $future) { if ($this->timeout) { $future->setTimeout($this->timeout); } if ($this->getByteLimit()) { $future->setStdoutSizeLimit($this->getByteLimit()); } try { $file_content = $this->executeQueryFromFuture($future); } catch (CommandException $ex) { if (!$future->getWasKilledByTimeout()) { throw $ex; } $message = pht('<Attempt to load this file was terminated after %s second(s).>', $this->timeout); $file_content = new DiffusionFileContent(); $file_content->setCorpus($message); } $this->fileContent = $file_content; $repository = $this->getRequest()->getRepository(); $try_encoding = $repository->getDetail('encoding'); if ($try_encoding) { $this->fileContent->setCorpus(phutil_utf8_convert($this->fileContent->getCorpus(), 'UTF-8', $try_encoding)); } return $this->fileContent; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); $commit = $drequest->getCommit(); list($corpus) = $repository->execxLocalCommand('cat --rev %s -- %s', $commit, $path); $file_content = new DiffusionFileContent(); $file_content->setCorpus($corpus); return $file_content; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); $commit = $drequest->getCommit(); if ($this->getNeedsBlame()) { list($corpus) = $repository->execxLocalCommand('--no-pager blame -c -l --date=short %s -- %s', $commit, $path); } else { list($corpus) = $repository->execxLocalCommand('cat-file blob %s:%s', $commit, $path); } $file_content = new DiffusionFileContent(); $file_content->setCorpus($corpus); return $file_content; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); $commit = $drequest->getCommit(); $local_path = $repository->getDetail('local-path'); if ($this->getNeedsBlame()) { list($corpus) = execx('(cd %s && git --no-pager blame -c -l --date=short %s -- %s)', $local_path, $commit, $path); } else { list($corpus) = execx('(cd %s && git cat-file blob %s:%s)', $local_path, $commit, $path); } $file_content = new DiffusionFileContent(); $file_content->setCorpus($corpus); return $file_content; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); $commit = $drequest->getCommit(); if ($this->getNeedsBlame()) { // NOTE: We're using "--number" instead of "--changeset" because there is // no way to get "--changeset" to show us the full commit hashes. list($corpus) = $repository->execxLocalCommand('annotate --user --number --rev %s -- %s', $commit, $path); } else { list($corpus) = $repository->execxLocalCommand('cat --rev %s -- %s', $commit, $path); } $file_content = new DiffusionFileContent(); $file_content->setCorpus($corpus); return $file_content; }
protected function executeQueryFromFuture(Future $future) { try { list($corpus) = $future->resolvex(); } catch (CommandException $ex) { $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; }