Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/query/PhabricatorDiffInlineCommentQuery.php
Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | if ($this->needInlineContext) { | ||||
((int)head($hunks)->getNewOffset() <= 1); | ((int)head($hunks)->getNewOffset() <= 1); | ||||
if (!$is_simple) { | if (!$is_simple) { | ||||
$inline->attachInlineContext(null); | $inline->attachInlineContext(null); | ||||
continue; | continue; | ||||
} | } | ||||
if ($inline->getIsNewFile()) { | if ($inline->getIsNewFile()) { | ||||
$vector = $changeset->getNewStatePathVector(); | |||||
$filename = last($vector); | |||||
$corpus = $changeset->makeNewFile(); | $corpus = $changeset->makeNewFile(); | ||||
} else { | } else { | ||||
$vector = $changeset->getOldStatePathVector(); | |||||
$filename = last($vector); | |||||
$corpus = $changeset->makeOldFile(); | $corpus = $changeset->makeOldFile(); | ||||
} | } | ||||
$corpus = phutil_split_lines($corpus); | $corpus = phutil_split_lines($corpus); | ||||
// Adjust the line number into a 0-based offset. | // Adjust the line number into a 0-based offset. | ||||
$offset = $inline->getLineNumber(); | $offset = $inline->getLineNumber(); | ||||
$offset = $offset - 1; | $offset = $offset - 1; | ||||
Show All 14 Lines | if ($this->needInlineContext) { | ||||
} | } | ||||
$body = array_slice($corpus, $offset, $length, true); | $body = array_slice($corpus, $offset, $length, true); | ||||
$tail = array_slice($corpus, $offset + $length, 3, true); | $tail = array_slice($corpus, $offset + $length, 3, true); | ||||
$tail = $this->simplifyContext($tail, false); | $tail = $this->simplifyContext($tail, false); | ||||
$context = id(new PhabricatorDiffInlineCommentContext()) | $context = id(new PhabricatorDiffInlineCommentContext()) | ||||
->setFilename($filename) | |||||
->setHeadLines($head) | ->setHeadLines($head) | ||||
->setBodyLines($body) | ->setBodyLines($body) | ||||
->setTailLines($tail); | ->setTailLines($tail); | ||||
$inline->attachInlineContext($context); | $inline->attachInlineContext($context); | ||||
} | } | ||||
} | } | ||||
Show All 34 Lines |