Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/parser/DifferentialChangesetParser.php
| Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | public function setCoverage($coverage) { | ||||
| $this->coverage = $coverage; | $this->coverage = $coverage; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| private function getCoverage() { | private function getCoverage() { | ||||
| return $this->coverage; | return $this->coverage; | ||||
| } | } | ||||
| public function parseInlineComment( | public function parseInlineComment( | ||||
| PhabricatorInlineCommentInterface $comment) { | PhabricatorInlineComment $comment) { | ||||
| // Parse only comments which are actually visible. | // Parse only comments which are actually visible. | ||||
| if ($this->isCommentVisibleOnRenderedDiff($comment)) { | if ($this->isCommentVisibleOnRenderedDiff($comment)) { | ||||
| $this->comments[] = $comment; | $this->comments[] = $comment; | ||||
| } | } | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 818 Lines • ▼ Show 20 Lines | private function calculateGapsAndMask( | ||||
| return array($gaps, $mask); | return array($gaps, $mask); | ||||
| } | } | ||||
| /** | /** | ||||
| * Determine if an inline comment will appear on the rendered diff, | * Determine if an inline comment will appear on the rendered diff, | ||||
| * taking into consideration which halves of which changesets will actually | * taking into consideration which halves of which changesets will actually | ||||
| * be shown. | * be shown. | ||||
| * | * | ||||
| * @param PhabricatorInlineCommentInterface Comment to test for visibility. | * @param PhabricatorInlineComment Comment to test for visibility. | ||||
| * @return bool True if the comment is visible on the rendered diff. | * @return bool True if the comment is visible on the rendered diff. | ||||
| */ | */ | ||||
| private function isCommentVisibleOnRenderedDiff( | private function isCommentVisibleOnRenderedDiff( | ||||
| PhabricatorInlineCommentInterface $comment) { | PhabricatorInlineComment $comment) { | ||||
| $changeset_id = $comment->getChangesetID(); | $changeset_id = $comment->getChangesetID(); | ||||
| $is_new = $comment->getIsNewFile(); | $is_new = $comment->getIsNewFile(); | ||||
| if ($changeset_id == $this->rightSideChangesetID && | if ($changeset_id == $this->rightSideChangesetID && | ||||
| $is_new == $this->rightSideAttachesToNewFile) { | $is_new == $this->rightSideAttachesToNewFile) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if ($changeset_id == $this->leftSideChangesetID && | if ($changeset_id == $this->leftSideChangesetID && | ||||
| $is_new == $this->leftSideAttachesToNewFile) { | $is_new == $this->leftSideAttachesToNewFile) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Determine if a comment will appear on the right side of the display diff. | * Determine if a comment will appear on the right side of the display diff. | ||||
| * Note that the comment must appear somewhere on the rendered changeset, as | * Note that the comment must appear somewhere on the rendered changeset, as | ||||
| * per isCommentVisibleOnRenderedDiff(). | * per isCommentVisibleOnRenderedDiff(). | ||||
| * | * | ||||
| * @param PhabricatorInlineCommentInterface Comment to test for display | * @param PhabricatorInlineComment Comment to test for display | ||||
| * location. | * location. | ||||
| * @return bool True for right, false for left. | * @return bool True for right, false for left. | ||||
| */ | */ | ||||
| private function isCommentOnRightSideWhenDisplayed( | private function isCommentOnRightSideWhenDisplayed( | ||||
| PhabricatorInlineCommentInterface $comment) { | PhabricatorInlineComment $comment) { | ||||
| if (!$this->isCommentVisibleOnRenderedDiff($comment)) { | if (!$this->isCommentVisibleOnRenderedDiff($comment)) { | ||||
| throw new Exception(pht('Comment is not visible on changeset!')); | throw new Exception(pht('Comment is not visible on changeset!')); | ||||
| } | } | ||||
| $changeset_id = $comment->getChangesetID(); | $changeset_id = $comment->getChangesetID(); | ||||
| $is_new = $comment->getIsNewFile(); | $is_new = $comment->getIsNewFile(); | ||||
| ▲ Show 20 Lines • Show All 660 Lines • Show Last 20 Lines | |||||