当前位置: 首页>>代码示例>>PHP>>正文


PHP DifferentialRevision类代码示例

本文整理汇总了PHP中DifferentialRevision的典型用法代码示例。如果您正苦于以下问题:PHP DifferentialRevision类的具体用法?PHP DifferentialRevision怎么用?PHP DifferentialRevision使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DifferentialRevision类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadRevisions

 private function loadRevisions($phid)
 {
     $table = new DifferentialRevision();
     $conn_r = $table->establishConnection('r');
     $rows = queryfx_all($conn_r, 'SELECT revisions.* FROM %T revisions ' . 'JOIN %T comments ON comments.revisionID = revisions.id ' . 'JOIN (' . ' SELECT revisionID FROM %T WHERE objectPHID = %s ' . ' UNION ALL ' . ' SELECT id from differential_revision WHERE authorPHID = %s) rel ' . 'ON (comments.revisionID = rel.revisionID)' . 'WHERE comments.action = %s' . 'AND comments.authorPHID = %s', $table->getTableName(), id(new DifferentialComment())->getTableName(), DifferentialRevision::RELATIONSHIP_TABLE, $phid, $phid, $this->filter, $phid);
     return $table->loadAllFromArray($rows);
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:7,代码来源:DifferentialRevisionStatsController.php

示例2: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     if (!$revision->getPHID()) {
         return array();
     }
     return PhabricatorEdgeQuery::loadDestinationPHIDs($revision->getPHID(), DifferentialRevisionHasTaskEdgeType::EDGECONST);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DifferentialManiphestTasksField.php

示例3: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     if (!$revision->getPHID()) {
         return array();
     }
     return PhabricatorSubscribersQuery::loadSubscribersForPHID($revision->getPHID());
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:DifferentialSubscribersField.php

示例4: __construct

 public function __construct(DifferentialRevision $revision, $mode)
 {
     $this->revision = $revision;
     $this->mode = $mode;
     $comments = id(new DifferentialComment())->loadAllWhere('revisionID = %d', $revision->getID());
     $this->comments = $comments;
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:7,代码来源:DifferentialCommitMessageData.php

示例5: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     if (!$revision->getPHID()) {
         return array();
     }
     $projects = PhabricatorEdgeQuery::loadDestinationPHIDs($revision->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
     $projects = array_reverse($projects);
     return $projects;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:DifferentialProjectsField.php

示例6: isActionDisabled

 /**
  * Check if this action should be disabled, and explain why.
  *
  * By default, this method checks for push permissions, and for the
  * revision being Accepted.
  *
  * @return False for "not disabled"; human-readable text explaining why, if
  *         it is disabled.
  */
 public function isActionDisabled(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $status = $revision->getStatus();
     if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
         return pht('Only Accepted revisions can be landed.');
     }
     if (!PhabricatorPolicyFilter::hasCapability($viewer, $repository, DiffusionPushCapability::CAPABILITY)) {
         return pht('You do not have permissions to push to this repository.');
     }
     return false;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:20,代码来源:DifferentialLandingStrategy.php

示例7: testReviewerStatsRequiresReview

 public function testReviewerStatsRequiresReview()
 {
     $revision = new DifferentialRevision();
     $revision->setDateCreated(1);
     $revision->attachRelationships(array($this->newReviewer('R')));
     $comments = array();
     $stats = new DifferentialReviewerStats();
     $stats->setUntil(2);
     list($reviewed, $not_reviewed) = $stats->computeTimes($revision, $comments);
     $this->assertEqual(array(), $reviewed);
     $this->assertEqual(array('R' => array(2 - 1)), $not_reviewed);
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:12,代码来源:DifferentialReviewerStatsTestCase.php

示例8: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     $phids = array();
     foreach ($revision->getReviewerStatus() as $reviewer) {
         switch ($reviewer->getStatus()) {
             case DifferentialReviewerStatus::STATUS_ACCEPTED:
             case DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER:
                 $phids[] = $reviewer->getReviewerPHID();
                 break;
         }
     }
     return $phids;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:13,代码来源:DifferentialReviewedByField.php

示例9: hasReviewersWithStatus

 protected function hasReviewersWithStatus(DifferentialRevision $revision, array $phids, array $statuses)
 {
     foreach ($revision->getReviewerStatus() as $reviewer) {
         $reviewer_phid = $reviewer->getReviewerPHID();
         if (empty($phids[$reviewer_phid])) {
             continue;
         }
         $status = $reviewer->getStatus();
         if (empty($statuses[$status])) {
             continue;
         }
         return true;
     }
     return false;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:15,代码来源:DifferentialRevisionResultBucket.php

示例10: loadFromStorage

 public static function loadFromStorage(DifferentialRevision $revision, array $aux_fields)
 {
     $storage_keys = array_filter(mpull($aux_fields, 'getStorageKey'));
     $field_data = array();
     if ($storage_keys) {
         $field_data = id(new DifferentialAuxiliaryField())->loadAllWhere('revisionPHID = %s AND name IN (%Ls)', $revision->getPHID(), $storage_keys);
         $field_data = mpull($field_data, 'getValue', 'getName');
     }
     foreach ($aux_fields as $aux_field) {
         $aux_field->setRevision($revision);
         $key = $aux_field->getStorageKey();
         if ($key) {
             $aux_field->setValueFromStorage(idx($field_data, $key));
         }
     }
     return $aux_fields;
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:17,代码来源:DifferentialAuxiliaryField.php

示例11: commitRevisionToWorkspace

 public function commitRevisionToWorkspace(DifferentialRevision $revision, ArcanistRepositoryAPI $workspace, PhabricatorUser $user)
 {
     $diff_id = $revision->loadActiveDiff()->getID();
     $call = new ConduitCall('differential.getrawdiff', array('diffID' => $diff_id));
     $call->setUser($user);
     $raw_diff = $call->execute();
     $future = $workspace->execFutureLocal('patch --no-commit -');
     $future->write($raw_diff);
     $future->resolvex();
     $workspace->reloadWorkingCopy();
     $call = new ConduitCall('differential.getcommitmessage', array('revision_id' => $revision->getID()));
     $call->setUser($user);
     $message = $call->execute();
     $author = id(new PhabricatorUser())->loadOneWhere('phid = %s', $revision->getAuthorPHID());
     $author_string = sprintf('%s <%s>', $author->getRealName(), $author->loadPrimaryEmailAddress());
     $author_date = $revision->getDateCreated();
     $workspace->execxLocal('commit --date=%s --user=%s ' . '--message=%s', $author_date . ' 0', $author_string, $message);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:18,代码来源:DifferentialLandingToHostedMercurial.php

示例12: loadUnsubmittedInlineComments

 public static function loadUnsubmittedInlineComments(PhabricatorUser $viewer, DifferentialRevision $revision)
 {
     // TODO: This probably needs to move somewhere more central as we move
     // away from DifferentialInlineCommentQuery, but
     // PhabricatorApplicationTransactionCommentQuery is currently `final` and
     // I'm not yet decided on how to approach that. For now, just get the PHIDs
     // and then execute a PHID-based query through the standard stack.
     $table = new DifferentialTransactionComment();
     $conn_r = $table->establishConnection('r');
     $phids = queryfx_all($conn_r, 'SELECT phid FROM %T
     WHERE revisionPHID = %s
       AND authorPHID = %s
       AND transactionPHID IS NULL', $table->getTableName(), $revision->getPHID(), $viewer->getPHID());
     $phids = ipull($phids, 'phid');
     if (!$phids) {
         return array();
     }
     return id(new PhabricatorApplicationTransactionCommentQuery())->setTemplate(new DifferentialTransactionComment())->setViewer($viewer)->withPHIDs($phids)->execute();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:19,代码来源:DifferentialTransactionQuery.php

示例13: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $diff = id(new DifferentialDiffQuery())->setViewer($viewer)->withIDs(array($request->getValue('diffid')))->executeOne();
     if (!$diff) {
         throw new ConduitException('ERR_BAD_DIFF');
     }
     $revision = DifferentialRevision::initializeNewRevision($viewer);
     $revision->attachReviewerStatus(array());
     $this->applyFieldEdit($request, $revision, $diff, $request->getValue('fields', array()), $message = null);
     return array('revisionid' => $revision->getID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:12,代码来源:DifferentialCreateRevisionConduitAPIMethod.php

示例14: commitRevisionToWorkspace

 public function commitRevisionToWorkspace(DifferentialRevision $revision, ArcanistRepositoryAPI $workspace, PhabricatorUser $user)
 {
     $diff_id = $revision->loadActiveDiff()->getID();
     $call = new ConduitCall('differential.getrawdiff', array('diffID' => $diff_id));
     $call->setUser($user);
     $raw_diff = $call->execute();
     $missing_binary = "\nindex " . "0000000000000000000000000000000000000000.." . "0000000000000000000000000000000000000000\n";
     if (strpos($raw_diff, $missing_binary) !== false) {
         throw new Exception(pht('Patch is missing content for a binary file'));
     }
     $future = $workspace->execFutureLocal('apply --index -');
     $future->write($raw_diff);
     $future->resolvex();
     $workspace->reloadWorkingCopy();
     $call = new ConduitCall('differential.getcommitmessage', array('revision_id' => $revision->getID()));
     $call->setUser($user);
     $message = $call->execute();
     $author = id(new PhabricatorUser())->loadOneWhere('phid = %s', $revision->getAuthorPHID());
     $author_string = sprintf('%s <%s>', $author->getRealName(), $author->loadPrimaryEmailAddress());
     $author_date = $revision->getDateCreated();
     $workspace->execxLocal('-c user.name=%s -c user.email=%s ' . 'commit --date=%s --author=%s ' . '--message=%s', $user->getRealName(), $user->loadPrimaryEmailAddress(), $author_date, $author_string, $message);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:22,代码来源:DifferentialHostedGitLandingStrategy.php

示例15: generateObject

 public function generateObject()
 {
     $author = $this->loadPhabrictorUser();
     $revision = DifferentialRevision::initializeNewRevision($author);
     $revision->attachReviewerStatus(array());
     $revision->attachActiveDiff(null);
     // This could be a bit richer and more formal than it is.
     $revision->setTitle($this->generateTitle());
     $revision->setSummary($this->generateDescription());
     $revision->setTestPlan($this->generateDescription());
     $diff = $this->generateDiff($author);
     $xactions = array();
     $xactions[] = id(new DifferentialTransaction())->setTransactionType(DifferentialTransaction::TYPE_UPDATE)->setNewValue($diff->getPHID());
     id(new DifferentialTransactionEditor())->setActor($author)->setContentSource($this->getLipsumContentSource())->applyTransactions($revision, $xactions);
     return $revision;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:16,代码来源:PhabricatorDifferentialRevisionTestDataGenerator.php


注:本文中的DifferentialRevision类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。