当前位置: 首页>>代码示例>>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;未经允许,请勿转载。