Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/parser/DifferentialChangesetParser.php
Show First 20 Lines • Show All 693 Lines • ▼ Show 20 Lines | if ($ignore_all) { | ||||
} | } | ||||
} | } | ||||
$hunk_parser = new DifferentialHunkParser(); | $hunk_parser = new DifferentialHunkParser(); | ||||
$hunk_parser->setWhitespaceMode($whitespace_mode); | $hunk_parser->setWhitespaceMode($whitespace_mode); | ||||
$hunk_parser->parseHunksForLineData($changeset->getHunks()); | $hunk_parser->parseHunksForLineData($changeset->getHunks()); | ||||
// Depending on the whitespace mode, we may need to compute a different | // Depending on the whitespace mode, we may need to compute a different | ||||
// set of changes than the set of changes in the hunk data (specificaly, | // set of changes than the set of changes in the hunk data (specifically, | ||||
// we might want to consider changed lines which have only whitespace | // we might want to consider changed lines which have only whitespace | ||||
// changes as unchanged). | // changes as unchanged). | ||||
if ($ignore_all) { | if ($ignore_all) { | ||||
$engine = new PhabricatorDifferenceEngine(); | $engine = new PhabricatorDifferenceEngine(); | ||||
$engine->setIgnoreWhitespace(true); | $engine->setIgnoreWhitespace(true); | ||||
$no_whitespace_changeset = $engine->generateChangesetFromFileContent( | $no_whitespace_changeset = $engine->generateChangesetFromFileContent( | ||||
$old_file, | $old_file, | ||||
$new_file); | $new_file); | ||||
▲ Show 20 Lines • Show All 476 Lines • ▼ Show 20 Lines | |||||
* "Show more context" spacers. If a gap is smaller than the context size, | * "Show more context" spacers. If a gap is smaller than the context size, | ||||
* we just display it. Otherwise, we record it into $gaps and will render a | * we just display it. Otherwise, we record it into $gaps and will render a | ||||
* "show more context" element instead of diff text below. A given $gap | * "show more context" element instead of diff text below. A given $gap | ||||
* is a tuple of $gap_line_number_start and $gap_length. | * is a tuple of $gap_line_number_start and $gap_length. | ||||
* | * | ||||
* Mask - compute the actual lines that need to be shown (because they | * Mask - compute the actual lines that need to be shown (because they | ||||
* are near changes lines, near inline comments, or the request has | * are near changes lines, near inline comments, or the request has | ||||
* explicitly asked for them, i.e. resulting from the user clicking | * explicitly asked for them, i.e. resulting from the user clicking | ||||
* "show more"). The $mask returned is a sparesely populated dictionary | * "show more"). The $mask returned is a sparsely populated dictionary | ||||
* of $visible_line_number => true. | * of $visible_line_number => true. | ||||
* | * | ||||
* Depths - compute how indented any given line is. The $depths returned | * Depths - compute how indented any given line is. The $depths returned | ||||
* is a sparesely populated dictionary of $visible_line_number => $depth. | * is a sparsely populated dictionary of $visible_line_number => $depth. | ||||
* | * | ||||
* This function also has the side effect of modifying member variable | * This function also has the side effect of modifying member variable | ||||
* new such that tabs are normalized to spaces for each line of the diff. | * new such that tabs are normalized to spaces for each line of the diff. | ||||
* | * | ||||
* @return array($gaps, $mask, $depths) | * @return array($gaps, $mask, $depths) | ||||
*/ | */ | ||||
private function calculateGapsMaskAndDepths( | private function calculateGapsMaskAndDepths( | ||||
$mask_force, | $mask_force, | ||||
▲ Show 20 Lines • Show All 431 Lines • Show Last 20 Lines |