當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。