當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DiffusionRequest類代碼示例

本文整理匯總了PHP中DiffusionRequest的典型用法代碼示例。如果您正苦於以下問題:PHP DiffusionRequest類的具體用法?PHP DiffusionRequest怎麽用?PHP DiffusionRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DiffusionRequest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildPropertyView

 protected function buildPropertyView(DiffusionRequest $drequest, PhabricatorActionListView $actions)
 {
     $viewer = $this->getRequest()->getUser();
     $view = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions);
     $stable_commit = $drequest->getStableCommit();
     $view->addProperty(pht('Commit'), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit)));
     return $view;
 }
開發者ID:demon,項目名稱:phabricator,代碼行數:8,代碼來源:DiffusionChangeController.php

示例2: newBlameFuture

 protected function newBlameFuture(DiffusionRequest $request, $path)
 {
     $repository = $request->getRepository();
     $commit = $request->getCommit();
     // NOTE: We're using "--debug" to make "--changeset" give us the full
     // commit hashes.
     return $repository->getLocalCommandFuture('annotate --debug --changeset --rev %s -- %s', $commit, $path);
 }
開發者ID:truSense,項目名稱:phabricator,代碼行數:8,代碼來源:DiffusionMercurialBlameQuery.php

示例3: newFile

 private function newFile(DiffusionRequest $drequest, $content)
 {
     $path = $drequest->getPath();
     $name = basename($path);
     $repository = $drequest->getRepository();
     $repository_phid = $repository->getPHID();
     $file = PhabricatorFile::buildFromFileDataOrHash($content, array('name' => $name, 'ttl' => time() + phutil_units('48 hours in seconds'), 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE));
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $file->attachToObject($repository_phid);
     unset($unguarded);
     return $file;
 }
開發者ID:modernfactory,項目名稱:phabricator,代碼行數:12,代碼來源:DiffusionFileContentQueryConduitAPIMethod.php

示例4: newQueryObject

 protected static function newQueryObject($base_class, DiffusionRequest $request)
 {
     $repository = $request->getRepository();
     $map = array(PhabricatorRepositoryType::REPOSITORY_TYPE_GIT => 'Git', PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL => 'Mercurial', PhabricatorRepositoryType::REPOSITORY_TYPE_SVN => 'Svn');
     $name = idx($map, $repository->getVersionControlSystem());
     if (!$name) {
         throw new Exception("Unsupported VCS!");
     }
     $class = str_replace('Diffusion', 'Diffusion' . $name, $base_class);
     $obj = new $class();
     $obj->request = $request;
     return $obj;
 }
開發者ID:ramons03,項目名稱:phabricator,代碼行數:13,代碼來源:DiffusionQuery.php

示例5: renderColumns

 private function renderColumns(DiffusionRequest $drequest, array $handles, PhabricatorRepositoryCommit $commit = null, $lint = null)
 {
     assert_instances_of($handles, 'PhabricatorObjectHandle');
     $viewer = $this->getRequest()->getUser();
     if ($commit) {
         $epoch = $commit->getEpoch();
         $modified = DiffusionView::linkCommit($drequest->getRepository(), $commit->getCommitIdentifier());
         $date = phabricator_date($epoch, $viewer);
         $time = phabricator_time($epoch, $viewer);
     } else {
         $modified = '';
         $date = '';
         $time = '';
     }
     $data = $commit->getCommitData();
     if ($data) {
         $author_phid = $data->getCommitDetail('authorPHID');
         if ($author_phid && isset($handles[$author_phid])) {
             $author = $handles[$author_phid]->renderLink();
         } else {
             $author = DiffusionView::renderName($data->getAuthorName());
         }
         $committer = $data->getCommitDetail('committer');
         if ($committer) {
             $committer_phid = $data->getCommitDetail('committerPHID');
             if ($committer_phid && isset($handles[$committer_phid])) {
                 $committer = $handles[$committer_phid]->renderLink();
             } else {
                 $committer = DiffusionView::renderName($committer);
             }
             if ($author != $committer) {
                 $author = hsprintf('%s/%s', $author, $committer);
             }
         }
         $details = AphrontTableView::renderSingleDisplayLine($data->getSummary());
     } else {
         $author = '';
         $details = '';
     }
     $return = array('commit' => $modified, 'date' => $date, 'time' => $time, 'author' => $author, 'details' => $details);
     if ($lint !== null) {
         $return['lint'] = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'lint', 'lint' => null))), number_format($lint));
     }
     // The client treats these results as markup, so make sure they have been
     // escaped correctly.
     foreach ($return as $key => $value) {
         $return[$key] = hsprintf('%s', $value);
     }
     return $return;
 }
開發者ID:fengshao0907,項目名稱:phabricator,代碼行數:50,代碼來源:DiffusionLastModifiedController.php

示例6: newFromDiffusionRequest

 public static final function newFromDiffusionRequest(DiffusionRequest $request)
 {
     $repository = $request->getRepository();
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $class = 'DiffusionGitBranchQuery';
             break;
         default:
             throw new Exception("Unsupported VCS!");
     }
     PhutilSymbolLoader::loadClass($class);
     $query = new $class();
     $query->request = $request;
     return $query;
 }
開發者ID:nguyennamtien,項目名稱:phabricator,代碼行數:15,代碼來源:DiffusionBranchQuery.php

示例7: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $repository_phid = $request->getStr('repositoryPHID');
     $repository = id(new PhabricatorRepository())->loadOneWhere('phid = %s', $repository_phid);
     if (!$repository) {
         return new Aphront400Response();
     }
     $query_path = $request->getStr('q');
     if (preg_match('@/$@', $query_path)) {
         $query_dir = $query_path;
     } else {
         $query_dir = dirname($query_path) . '/';
     }
     $query_dir = ltrim($query_dir, '/');
     $drequest = DiffusionRequest::newFromDictionary(array('repository' => $repository, 'path' => $query_dir));
     $browse_query = DiffusionBrowseQuery::newFromDiffusionRequest($drequest);
     $paths = $browse_query->loadPaths();
     $output = array();
     foreach ($paths as $path) {
         $full_path = $query_dir . $path->getPath();
         if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
             $full_path .= '/';
         }
         $output[] = array('/' . $full_path, null, substr(md5($full_path), 0, 7));
     }
     return id(new AphrontAjaxResponse())->setContent($output);
 }
開發者ID:nexeck,項目名稱:phabricator,代碼行數:28,代碼來源:DiffusionPathCompleteController.php

示例8: newFromDiffusionRequest

 public static final function newFromDiffusionRequest(DiffusionRequest $request)
 {
     $repository = $request->getRepository();
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $query = new DiffusionGitBranchQuery();
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $query = new DiffusionMercurialBranchQuery();
             break;
         default:
             throw new Exception("Unsupported VCS!");
     }
     $query->request = $request;
     return $query;
 }
開發者ID:nexeck,項目名稱:phabricator,代碼行數:16,代碼來源:DiffusionBranchQuery.php

示例9: willProcessRequest

 public function willProcessRequest(array $data)
 {
     if (isset($data['callsign'])) {
         $drequest = DiffusionRequest::newFromAphrontRequestDictionary($data);
         $this->diffusionRequest = $drequest;
     }
 }
開發者ID:rudimk,項目名稱:phabricator,代碼行數:7,代碼來源:DiffusionController.php

示例10: willProcessRequest

 public function willProcessRequest(array $data)
 {
     // This controller doesn't use blob/path stuff, just pass the dictionary
     // in directly instead of using the AphrontRequest parsing mechanism.
     $drequest = DiffusionRequest::newFromDictionary($data);
     $this->diffusionRequest = $drequest;
 }
開發者ID:ramons03,項目名稱:phabricator,代碼行數:7,代碼來源:DiffusionCommitController.php

示例11: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $repository_phid = $request->getStr('repositoryPHID');
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($request->getUser())->withPHIDs(array($repository_phid))->executeOne();
     if (!$repository) {
         return new Aphront400Response();
     }
     $query_path = $request->getStr('q');
     if (preg_match('@/$@', $query_path)) {
         $query_dir = $query_path;
     } else {
         $query_dir = dirname($query_path) . '/';
     }
     $query_dir = ltrim($query_dir, '/');
     $drequest = DiffusionRequest::newFromDictionary(array('user' => $request->getUser(), 'repository' => $repository, 'path' => $query_dir));
     $this->setDiffusionRequest($drequest);
     $browse_results = DiffusionBrowseResultSet::newFromConduit($this->callConduitWithDiffusionRequest('diffusion.browsequery', array('path' => $drequest->getPath(), 'commit' => $drequest->getCommit())));
     $paths = $browse_results->getPaths();
     $output = array();
     foreach ($paths as $path) {
         $full_path = $query_dir . $path->getPath();
         if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
             $full_path .= '/';
         }
         $output[] = array('/' . $full_path, null, substr(md5($full_path), 0, 7));
     }
     return id(new AphrontAjaxResponse())->setContent($output);
 }
開發者ID:patelhardik,項目名稱:phabricator,代碼行數:28,代碼來源:DiffusionPathCompleteController.php

示例12: testURIGeneration

 public function testURIGeneration()
 {
     $map = array('/diffusion/A/browse/branch/path.ext;abc$1' => array('action' => 'browse', 'callsign' => 'A', 'branch' => 'branch', 'path' => 'path.ext', 'commit' => 'abc', 'line' => '1'), '/diffusion/A/browse/a%252Fb/path.ext' => array('action' => 'browse', 'callsign' => 'A', 'branch' => 'a/b', 'path' => 'path.ext'), '/diffusion/A/browse/%2B/%20%21' => array('action' => 'browse', 'callsign' => 'A', 'path' => '+/ !'), '/diffusion/A/browse/money/%24%24100$2' => array('action' => 'browse', 'callsign' => 'A', 'path' => 'money/$100', 'line' => '2'), '/diffusion/A/browse/path/to/file.ext?view=things' => array('action' => 'browse', 'callsign' => 'A', 'path' => 'path/to/file.ext', 'params' => array('view' => 'things')), '/diffusion/A/repository/master/' => array('action' => 'branch', 'callsign' => 'A', 'branch' => 'master'), 'path/to/file.ext;abc' => array('action' => 'rendering-ref', 'path' => 'path/to/file.ext', 'commit' => 'abc'), '/diffusion/A/browse/branch/path.ext$3-5%2C7-12%2C14' => array('action' => 'browse', 'callsign' => 'A', 'branch' => 'branch', 'path' => 'path.ext', 'line' => '3-5,7-12,14'));
     foreach ($map as $expect => $input) {
         $actual = DiffusionRequest::generateDiffusionURI($input);
         $this->assertEqual($expect, (string) $actual);
     }
 }
開發者ID:patelhardik,項目名稱:phabricator,代碼行數:8,代碼來源:DiffusionURITestCase.php

示例13: getURI

 public function getURI()
 {
     if ($this->isExternal) {
         return $this->externalURI;
     }
     $request = DiffusionRequest::newFromDictionary(array('user' => PhabricatorUser::getOmnipotentUser(), 'repository' => $this->getRepository()));
     return $request->generateURI(array('action' => 'browse', 'path' => $this->getPath(), 'line' => $this->getLineNumber()));
 }
開發者ID:pugong,項目名稱:phabricator,代碼行數:8,代碼來源:PhabricatorRepositorySymbol.php

示例14: loadDiffusionChangesForCommit

 private static function loadDiffusionChangesForCommit($commit)
 {
     $repository = id(new PhabricatorRepository())->load($commit->getRepositoryID());
     $data = array('user' => PhabricatorUser::getOmnipotentUser(), 'initFromConduit' => false, 'repository' => $repository, 'commit' => $commit->getCommitIdentifier());
     $drequest = DiffusionRequest::newFromDictionary($data);
     $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest($drequest);
     return $change_query->loadChanges();
 }
開發者ID:denghp,項目名稱:phabricator,代碼行數:8,代碼來源:PhabricatorOwnersPackagePathValidator.php

示例15: parseCommit

 protected final function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
 {
     $viewer = PhabricatorUser::getOmnipotentUser();
     $refs_raw = DiffusionQuery::callConduitWithDiffusionRequest($viewer, DiffusionRequest::newFromDictionary(array('repository' => $repository, 'user' => $viewer)), 'diffusion.querycommits', array('repositoryPHID' => $repository->getPHID(), 'phids' => array($commit->getPHID()), 'bypassCache' => true, 'needMessages' => true));
     if (empty($refs_raw['data'])) {
         throw new Exception(pht('Unable to retrieve details for commit "%s"!', $commit->getPHID()));
     }
     $ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data']));
     $this->parseCommitWithRef($repository, $commit, $ref);
 }
開發者ID:vinzent,項目名稱:phabricator,代碼行數:10,代碼來源:PhabricatorRepositoryCommitMessageParserWorker.php


注:本文中的DiffusionRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。