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


PHP DifferentialRevision::getID方法代码示例

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


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

示例1: __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

示例2: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     if (!$revision->getID()) {
         return null;
     }
     return $revision->getTestPlan();
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:DifferentialTestPlanField.php

示例3: indexRevision

 public static function indexRevision(DifferentialRevision $rev)
 {
     $doc = new PhabricatorSearchAbstractDocument();
     $doc->setPHID($rev->getPHID());
     $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_DREV);
     $doc->setDocumentTitle($rev->getTitle());
     $doc->setDocumentCreated($rev->getDateCreated());
     $doc->setDocumentModified($rev->getDateModified());
     $doc->addField(PhabricatorSearchField::FIELD_BODY, $rev->getSummary());
     $doc->addField(PhabricatorSearchField::FIELD_TEST_PLAN, $rev->getTestPlan());
     $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $rev->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $rev->getDateCreated());
     if ($rev->getStatus() != ArcanistDifferentialRevisionStatus::CLOSED && $rev->getStatus() != ArcanistDifferentialRevisionStatus::ABANDONED) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $rev->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_DREV, time());
     }
     $comments = id(new DifferentialComment())->loadAllWhere('revisionID = %d', $rev->getID());
     $inlines = id(new DifferentialInlineComment())->loadAllWhere('revisionID = %d AND commentID IS NOT NULL', $rev->getID());
     $touches = array();
     foreach (array_merge($comments, $inlines) as $comment) {
         if (strlen($comment->getContent())) {
             $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $comment->getContent());
         }
         $author = $comment->getAuthorPHID();
         $touches[$author] = $comment->getDateCreated();
     }
     foreach ($touches as $touch => $time) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_TOUCH, $touch, PhabricatorPHIDConstants::PHID_TYPE_USER, $time);
     }
     $rev->loadRelationships();
     // If a revision needs review, the owners are the reviewers. Otherwise, the
     // owner is the author (e.g., accepted, rejected, closed).
     if ($rev->getStatus() == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) {
         foreach ($rev->getReviewers() as $phid) {
             $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $phid, PhabricatorPHIDConstants::PHID_TYPE_USER, $rev->getDateModified());
             // Bogus timestamp.
         }
     } else {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $rev->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $rev->getDateCreated());
     }
     $ccphids = $rev->getCCPHIDs();
     $handles = id(new PhabricatorObjectHandleData($ccphids))->loadHandles();
     foreach ($handles as $phid => $handle) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, $phid, $handle->getType(), $rev->getDateModified());
         // Bogus timestamp.
     }
     self::reindexAbstractDocument($doc);
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:46,代码来源:PhabricatorSearchDifferentialIndexer.php

示例4: 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

示例5: 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

示例6: buildSideNavView

 private function buildSideNavView(DifferentialRevision $revision, array $changesets)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/D' . $revision->getID()));
     $nav->setFlexible(true);
     $nav->addFilter('top', 'D' . $revision->getID(), '#top', $relative = false, 'phabricator-active-nav-focus');
     $tree = new PhutilFileTree();
     foreach ($changesets as $changeset) {
         $tree->addPath($changeset->getFilename(), $changeset);
     }
     require_celerity_resource('phabricator-filetree-view-css');
     $filetree = array();
     $path = $tree;
     while ($path = $path->getNextNode()) {
         $data = $path->getData();
         $name = $path->getName();
         $style = 'padding-left: ' . (2 + 3 * $path->getDepth()) . 'px';
         $href = null;
         if ($data) {
             $href = '#' . $data->getAnchorName();
             $icon = 'phabricator-filetree-icon-file';
         } else {
             $name .= '/';
             $icon = 'phabricator-filetree-icon-dir';
         }
         $icon = phutil_render_tag('span', array('class' => 'phabricator-filetree-icon ' . $icon), '');
         $name_element = phutil_render_tag('span', array('class' => 'phabricator-filetree-name'), phutil_escape_html($name));
         $filetree[] = javelin_render_tag($href ? 'a' : 'span', array('href' => $href, 'style' => $style, 'title' => $name, 'class' => 'phabricator-filetree-item'), $icon . $name_element);
     }
     $tree->destroy();
     $filetree = '<div class="phabricator-filetree">' . implode("\n", $filetree) . '</div>';
     $nav->addFilter('toc', 'Table of Contents', '#toc');
     $nav->addCustomBlock($filetree);
     $nav->addFilter('comment', 'Add Comment', '#comment');
     $nav->setActive(true);
     return $nav;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:37,代码来源:DifferentialRevisionViewController.php

示例7: rejectOperation

 private function rejectOperation(DifferentialRevision $revision, $title, $body)
 {
     $id = $revision->getID();
     $detail_uri = "/D{$id}";
     return $this->newDialog()->setTitle($title)->appendParagraph($body)->addCancelButton($detail_uri);
 }
开发者ID:nilsdornblut,项目名称:phabricator,代码行数:6,代码来源:DifferentialRevisionOperationController.php

示例8: updateRevisionHashTable

 /**
  * Update the table connecting revisions to DVCS local hashes, so we can
  * identify revisions by commit/tree hashes.
  */
 private function updateRevisionHashTable(DifferentialRevision $revision, DifferentialDiff $diff)
 {
     $vcs = $diff->getSourceControlSystem();
     if ($vcs == DifferentialRevisionControlSystem::SVN) {
         // Subversion has no local commit or tree hash information, so we don't
         // have to do anything.
         return;
     }
     $property = id(new DifferentialDiffProperty())->loadOneWhere('diffID = %d AND name = %s', $diff->getID(), 'local:commits');
     if (!$property) {
         return;
     }
     $hashes = array();
     $data = $property->getData();
     switch ($vcs) {
         case DifferentialRevisionControlSystem::GIT:
             foreach ($data as $commit) {
                 $hashes[] = array(ArcanistDifferentialRevisionHash::HASH_GIT_COMMIT, $commit['commit']);
                 $hashes[] = array(ArcanistDifferentialRevisionHash::HASH_GIT_TREE, $commit['tree']);
             }
             break;
         case DifferentialRevisionControlSystem::MERCURIAL:
             foreach ($data as $commit) {
                 $hashes[] = array(ArcanistDifferentialRevisionHash::HASH_MERCURIAL_COMMIT, $commit['rev']);
             }
             break;
     }
     $conn_w = $revision->establishConnection('w');
     $sql = array();
     foreach ($hashes as $info) {
         list($type, $hash) = $info;
         $sql[] = qsprintf($conn_w, '(%d, %s, %s)', $revision->getID(), $type, $hash);
     }
     queryfx($conn_w, 'DELETE FROM %T WHERE revisionID = %d', ArcanistDifferentialRevisionHash::TABLE_NAME, $revision->getID());
     if ($sql) {
         queryfx($conn_w, 'INSERT INTO %T (revisionID, type, hash) VALUES %Q', ArcanistDifferentialRevisionHash::TABLE_NAME, implode(', ', $sql));
     }
 }
开发者ID:kristain,项目名称:phabricator,代码行数:42,代码来源:DifferentialTransactionEditor.php

示例9: loadInlineComments

 private function loadInlineComments(DifferentialRevision $revision, array &$changesets)
 {
     assert_instances_of($changesets, 'DifferentialChangeset');
     $inline_comments = array();
     $inline_comments = id(new DifferentialInlineCommentQuery())->withRevisionIDs(array($revision->getID()))->withNotDraft(true)->execute();
     $load_changesets = array();
     foreach ($inline_comments as $inline) {
         $changeset_id = $inline->getChangesetID();
         if (isset($changesets[$changeset_id])) {
             continue;
         }
         $load_changesets[$changeset_id] = true;
     }
     $more_changesets = array();
     if ($load_changesets) {
         $changeset_ids = array_keys($load_changesets);
         $more_changesets += id(new DifferentialChangeset())->loadAllWhere('id IN (%Ld)', $changeset_ids);
     }
     if ($more_changesets) {
         $changesets += $more_changesets;
         $changesets = msort($changesets, 'getSortKey');
     }
     return $inline_comments;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:24,代码来源:DifferentialRevisionViewController.php

示例10: getRevisionActions

 private function getRevisionActions(DifferentialRevision $revision)
 {
     $viewer_phid = $this->getRequest()->getUser()->getPHID();
     $viewer_is_owner = $revision->getAuthorPHID() == $viewer_phid;
     $viewer_is_reviewer = in_array($viewer_phid, $revision->getReviewers());
     $viewer_is_cc = in_array($viewer_phid, $revision->getCCPHIDs());
     $viewer_is_anonymous = !$this->getRequest()->getUser()->isLoggedIn();
     $status = $revision->getStatus();
     $revision_id = $revision->getID();
     $revision_phid = $revision->getPHID();
     $links = array();
     if ($viewer_is_owner) {
         $links[] = array('class' => 'revision-edit', 'href' => "/differential/revision/edit/{$revision_id}/", 'name' => 'Edit Revision');
     }
     if (!$viewer_is_anonymous) {
         if (!$viewer_is_owner && !$viewer_is_reviewer) {
             $action = $viewer_is_cc ? 'rem' : 'add';
             $links[] = array('class' => $viewer_is_cc ? 'subscribe-rem' : 'subscribe-add', 'href' => "/differential/subscribe/{$action}/{$revision_id}/", 'name' => $viewer_is_cc ? 'Unsubscribe' : 'Subscribe', 'instant' => true);
         } else {
             $links[] = array('class' => 'subscribe-rem unavailable', 'name' => 'Automatically Subscribed');
         }
         require_celerity_resource('phabricator-object-selector-css');
         require_celerity_resource('javelin-behavior-phabricator-object-selector');
         $links[] = array('class' => 'action-dependencies', 'name' => 'Edit Dependencies', 'href' => "/search/attach/{$revision_phid}/DREV/dependencies/", 'sigil' => 'workflow');
         if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
             $links[] = array('class' => 'attach-maniphest', 'name' => 'Edit Maniphest Tasks', 'href' => "/search/attach/{$revision_phid}/TASK/", 'sigil' => 'workflow');
         }
         $links[] = array('class' => 'transcripts-metamta', 'name' => 'MetaMTA Transcripts', 'href' => "/mail/?phid={$revision_phid}");
         $links[] = array('class' => 'transcripts-herald', 'name' => 'Herald Transcripts', 'href' => "/herald/transcript/?phid={$revision_phid}");
     }
     return $links;
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:32,代码来源:DifferentialRevisionViewController.php

示例11: renderValueForRevisionList

 public function renderValueForRevisionList(DifferentialRevision $revision)
 {
     return 'D' . $revision->getID();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:4,代码来源:DifferentialRevisionIDFieldSpecification.php

示例12: attachToRevision

 private function attachToRevision(DifferentialRevision $revision, $actor_phid)
 {
     $drequest = DiffusionRequest::newFromDictionary(array('repository' => $this->repository, 'commit' => $this->commit->getCommitIdentifier()));
     $raw_diff = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest)->loadRawDiff();
     $changes = id(new ArcanistDiffParser())->parseDiff($raw_diff);
     $diff = DifferentialDiff::newFromRawChanges($changes)->setRevisionID($revision->getID())->setAuthorPHID($actor_phid)->setCreationMethod('commit')->setSourceControlSystem($this->repository->getVersionControlSystem())->setLintStatus(DifferentialLintStatus::LINT_SKIP)->setUnitStatus(DifferentialUnitStatus::UNIT_SKIP)->setDateCreated($this->commit->getEpoch())->setDescription('Commit r' . $this->repository->getCallsign() . $this->commit->getCommitIdentifier());
     // TODO: This is not correct in SVN where one repository can have multiple
     // Arcanist projects.
     $arcanist_project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere('repositoryID = %d LIMIT 1', $this->repository->getID());
     if ($arcanist_project) {
         $diff->setArcanistProjectPHID($arcanist_project->getPHID());
     }
     $parents = DiffusionCommitParentsQuery::newFromDiffusionRequest($drequest)->loadParents();
     if ($parents) {
         $diff->setSourceControlBaseRevision(head_key($parents));
     }
     // TODO: Attach binary files.
     $revision->setLineCount($diff->getLineCount());
     return $diff->save();
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:20,代码来源:PhabricatorRepositoryCommitMessageParserWorker.php

示例13: buildSideNavView

 private function buildSideNavView(DifferentialRevision $revision, array $changesets)
 {
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/D' . $revision->getID()));
     $nav->setFlexible(true);
     $nav->addFilter('top', 'D' . $revision->getID(), '#top', $relative = false, 'phabricator-active-nav-focus');
     $tree = new PhutilFileTree();
     foreach ($changesets as $changeset) {
         try {
             $tree->addPath($changeset->getFilename(), $changeset);
         } catch (Exception $ex) {
             // TODO: See T1702. When viewing the versus diff of diffs, we may
             // have files with the same filename. For example, if you have a setup
             // like this in SVN:
             //
             //  a/
             //    README
             //  b/
             //    README
             //
             // ...and you run "arc diff" once from a/, and again from b/, you'll
             // get two diffs with path README. However, in the versus diff view we
             // will compute their absolute repository paths and detect that they
             // aren't really the same file. This is correct, but causes us to
             // throw when inserting them.
             //
             // We should probably compute the smallest unique path for each file
             // and show these as "a/README" and "b/README" when diffed against
             // one another. However, we get this wrong in a lot of places (the
             // other TOC shows two "README" files, and we generate the same anchor
             // hash for both) so I'm just stopping the bleeding until we can get
             // a proper fix in place.
         }
     }
     require_celerity_resource('phabricator-filetree-view-css');
     $filetree = array();
     $path = $tree;
     while ($path = $path->getNextNode()) {
         $data = $path->getData();
         $name = $path->getName();
         $style = 'padding-left: ' . (2 + 3 * $path->getDepth()) . 'px';
         $href = null;
         if ($data) {
             $href = '#' . $data->getAnchorName();
             $title = $name;
             $icon = 'phabricator-filetree-icon-file';
         } else {
             $name .= '/';
             $title = $path->getFullPath() . '/';
             $icon = 'phabricator-filetree-icon-dir';
         }
         $icon = phutil_render_tag('span', array('class' => 'phabricator-filetree-icon ' . $icon), '');
         $name_element = phutil_render_tag('span', array('class' => 'phabricator-filetree-name'), phutil_escape_html($name));
         $filetree[] = javelin_render_tag($href ? 'a' : 'span', array('href' => $href, 'style' => $style, 'title' => $title, 'class' => 'phabricator-filetree-item'), $icon . $name_element);
     }
     $tree->destroy();
     $filetree = '<div class="phabricator-filetree">' . implode("\n", $filetree) . '</div>';
     $nav->addFilter('toc', 'Table of Contents', '#toc');
     $nav->addCustomBlock($filetree);
     $nav->addFilter('comment', 'Add Comment', '#comment');
     $nav->setActive(true);
     return $nav;
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:63,代码来源:DifferentialRevisionViewController.php

示例14: adjustInlinesForChangesets

 public function adjustInlinesForChangesets(array $inlines, array $old, array $new, DifferentialRevision $revision)
 {
     assert_instances_of($inlines, 'DifferentialInlineComment');
     assert_instances_of($old, 'DifferentialChangeset');
     assert_instances_of($new, 'DifferentialChangeset');
     $viewer = $this->getViewer();
     $pref = $viewer->loadPreferences()->getPreference(PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS);
     if ($pref == 'disabled') {
         return $inlines;
     }
     $all = array_merge($old, $new);
     $changeset_ids = mpull($inlines, 'getChangesetID');
     $changeset_ids = array_unique($changeset_ids);
     $all_map = mpull($all, null, 'getID');
     // We already have at least some changesets, and we might not need to do
     // any more data fetching. Remove everything we already have so we can
     // tell if we need new stuff.
     foreach ($changeset_ids as $key => $id) {
         if (isset($all_map[$id])) {
             unset($changeset_ids[$key]);
         }
     }
     if ($changeset_ids) {
         $changesets = id(new DifferentialChangesetQuery())->setViewer($viewer)->withIDs($changeset_ids)->execute();
         $changesets = mpull($changesets, null, 'getID');
     } else {
         $changesets = array();
     }
     $changesets += $all_map;
     $id_map = array();
     foreach ($all as $changeset) {
         $id_map[$changeset->getID()] = $changeset->getID();
     }
     // Generate filename maps for older and newer comments. If we're bringing
     // an older comment forward in a diff-of-diffs, we want to put it on the
     // left side of the screen, not the right side. Both sides are "new" files
     // with the same name, so they're both appropriate targets, but the left
     // is a better target conceptually for users because it's more consistent
     // with the rest of the UI, which shows old information on the left and
     // new information on the right.
     $move_here = DifferentialChangeType::TYPE_MOVE_HERE;
     $name_map_old = array();
     $name_map_new = array();
     $move_map = array();
     foreach ($all as $changeset) {
         $changeset_id = $changeset->getID();
         $filenames = array();
         $filenames[] = $changeset->getFilename();
         // If this is the target of a move, also map comments on the old filename
         // to this changeset.
         if ($changeset->getChangeType() == $move_here) {
             $old_file = $changeset->getOldFile();
             $filenames[] = $old_file;
             $move_map[$changeset_id][$old_file] = true;
         }
         foreach ($filenames as $filename) {
             // We update the old map only if we don't already have an entry (oldest
             // changeset persists).
             if (empty($name_map_old[$filename])) {
                 $name_map_old[$filename] = $changeset_id;
             }
             // We always update the new map (newest changeset overwrites).
             $name_map_new[$changeset->getFilename()] = $changeset_id;
         }
     }
     // Find the smallest "new" changeset ID. We'll consider everything
     // larger than this to be "newer", and everything smaller to be "older".
     $first_new_id = min(mpull($new, 'getID'));
     $results = array();
     foreach ($inlines as $inline) {
         $changeset_id = $inline->getChangesetID();
         if (isset($id_map[$changeset_id])) {
             // This inline is legitimately on one of the current changesets, so
             // we can include it in the result set unmodified.
             $results[] = $inline;
             continue;
         }
         $changeset = idx($changesets, $changeset_id);
         if (!$changeset) {
             // Just discard this inline, as it has bogus data.
             continue;
         }
         $target_id = null;
         if ($changeset_id >= $first_new_id) {
             $name_map = $name_map_new;
             $is_new = true;
         } else {
             $name_map = $name_map_old;
             $is_new = false;
         }
         $filename = $changeset->getFilename();
         if (isset($name_map[$filename])) {
             // This changeset is on a file with the same name as the current
             // changeset, so we're going to port it forward or backward.
             $target_id = $name_map[$filename];
             $is_move = isset($move_map[$target_id][$filename]);
             if ($is_new) {
                 if ($is_move) {
                     $reason = pht('This comment was made on a file with the same name as the ' . 'file this file was moved from, but in a newer diff.');
                 } else {
//.........这里部分代码省略.........
开发者ID:pugong,项目名称:phabricator,代码行数:101,代码来源:DifferentialInlineCommentQuery.php

示例15: buildCommentForm

 private function buildCommentForm(DifferentialRevision $revision, $field_list)
 {
     $viewer = $this->getViewer();
     $draft = id(new PhabricatorDraft())->loadOneWhere('authorPHID = %s AND draftKey = %s', $viewer->getPHID(), 'differential-comment-' . $revision->getID());
     $reviewers = array();
     $ccs = array();
     if ($draft) {
         $reviewers = idx($draft->getMetadata(), 'reviewers', array());
         $ccs = idx($draft->getMetadata(), 'ccs', array());
         if ($reviewers || $ccs) {
             $handles = $this->loadViewerHandles(array_merge($reviewers, $ccs));
             $reviewers = array_select_keys($handles, $reviewers);
             $ccs = array_select_keys($handles, $ccs);
         }
     }
     $comment_form = id(new DifferentialAddCommentView())->setRevision($revision);
     $review_warnings = array();
     foreach ($field_list->getFields() as $field) {
         $review_warnings[] = $field->getWarningsForDetailView();
     }
     $review_warnings = array_mergev($review_warnings);
     if ($review_warnings) {
         $review_warnings_panel = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_WARNING)->setErrors($review_warnings);
         $comment_form->setInfoView($review_warnings_panel);
     }
     $action_uri = $this->getApplicationURI('comment/save/' . $revision->getID() . '/');
     $comment_form->setActions($this->getRevisionCommentActions($revision))->setActionURI($action_uri)->setUser($viewer)->setDraft($draft)->setReviewers(mpull($reviewers, 'getFullName', 'getPHID'))->setCCs(mpull($ccs, 'getFullName', 'getPHID'));
     // TODO: This just makes the "Z" key work. Generalize this and remove
     // it at some point.
     $comment_form = phutil_tag('div', array('class' => 'differential-add-comment-panel'), $comment_form);
     return $comment_form;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:32,代码来源:DifferentialRevisionViewController.php


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