Page MenuHomePhorge
Diviner Tech Docs DifferentialChangesetParser

final class DifferentialChangesetParser
Phorge Technical Documentation (Differential)

This class is not documented.

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function setRange($start, $end)

This method is not documented.
Parameters
$start
$end
Return
wild

public function setMask($mask)

This method is not documented.
Parameters
array$mask
Return
wild

public function renderChangeset()

This method is not documented.
Return
wild

public function setShowEditAndReplyLinks($bool)

This method is not documented.
Parameters
$bool
Return
wild

public function getShowEditAndReplyLinks()

This method is not documented.
Return
wild

public function setViewState($view_state)

This method is not documented.
Parameters
PhabricatorChangesetViewState$view_state
Return
wild

public function getViewState()

This method is not documented.
Return
wild

public function setRenderer($renderer)

This method is not documented.
Parameters
DifferentialChangesetRenderer$renderer
Return
wild

public function getRenderer()

This method is not documented.
Return
wild

public function setDisableCache($disable_cache)

This method is not documented.
Parameters
$disable_cache
Return
wild

public function getDisableCache()

This method is not documented.
Return
wild

public function setCanMarkDone($can_mark_done)

This method is not documented.
Parameters
$can_mark_done
Return
wild

public function getCanMarkDone()

This method is not documented.
Return
wild

public function setObjectOwnerPHID($phid)

This method is not documented.
Parameters
$phid
Return
wild

public function getObjectOwnerPHID()

This method is not documented.
Return
wild

public function setOffsetMode($offset_mode)

This method is not documented.
Parameters
$offset_mode
Return
wild

public function getOffsetMode()

This method is not documented.
Return
wild

public function setViewer($viewer)

This method is not documented.
Parameters
PhabricatorUser$viewer
Return
wild

public function getViewer()

This method is not documented.
Return
wild

private function newRenderer()

This method is not documented.
Return
wild

public function setOldLines($lines)

This method is not documented.
Parameters
array$lines
Return
wild

public function setNewLines($lines)

This method is not documented.
Parameters
array$lines
Return
wild

public function setSpecialAttributes($attributes)

This method is not documented.
Parameters
array$attributes
Return
wild

public function setIntraLineDiffs($diffs)

This method is not documented.
Parameters
array$diffs
Return
wild

public function setDepthOnlyLines($lines)

This method is not documented.
Parameters
array$lines
Return
wild

public function getDepthOnlyLines()

This method is not documented.
Return
wild

public function setVisibleLinesMask($mask)

This method is not documented.
Parameters
array$mask
Return
wild

public function setLinesOfContext($lines_of_context)

This method is not documented.
Parameters
$lines_of_context
Return
wild

public function getLinesOfContext()

This method is not documented.
Return
wild

public function setRightSideCommentMapping($id, $is_new)

Configure which Changeset comments added to the right side of the visible diff will be attached to. The ID must be the ID of a real Differential Changeset.

The complexity here is that we may show an arbitrary side of an arbitrary changeset as either the left or right part of a diff. This method allows the left and right halves of the displayed diff to be correctly mapped to storage changesets.

Parameters
id$idThe Differential Changeset ID that comments added to the right side of the visible diff should be attached to.
bool$is_newIf true, attach new comments to the right side of the storage changeset. Note that this may be false, if the left side of some storage changeset is being shown as the right side of a display diff.
Return
this

public function setLeftSideCommentMapping($id, $is_new)

See setRightSideCommentMapping(), but this sets information for the left side of the display diff.

Parameters
$id
$is_new
Return
wild

public function setOriginals($left, $right)

This method is not documented.
Parameters
DifferentialChangeset$left
DifferentialChangeset$right
Return
wild

public function diffOriginals()

This method is not documented.
Return
wild

public function setRenderCacheKey($key)

Set a key for identifying this changeset in the render cache. If set, the parser will attempt to use the changeset render cache, which can improve performance for frequently-viewed changesets.

By default, there is no render cache key and parsers do not use the cache. This is appropriate for rarely-viewed changesets.

Parameters
string$keyKey for identifying this changeset in the render cache.
Return
this

private function getRenderCacheKey()

This method is not documented.
Return
wild

public function setChangeset($changeset)

This method is not documented.
Parameters
DifferentialChangeset$changeset
Return
wild

public function setRenderingReference($ref)

This method is not documented.
Parameters
$ref
Return
wild

private function getRenderingReference()

This method is not documented.
Return
wild

public function getChangeset()

This method is not documented.
Return
wild

public function setFilename($filename)

This method is not documented.
Parameters
$filename
Return
wild

public function setHandles($handles)

This method is not documented.
Parameters
array$handles
Return
wild

public function setMarkupEngine($engine)

This method is not documented.
Parameters
PhabricatorMarkupEngine$engine
Return
wild

public function setCoverage($coverage)

This method is not documented.
Parameters
$coverage
Return
wild

private function getCoverage()

This method is not documented.
Return
wild

public function parseInlineComment($comment)

This method is not documented.
Parameters
PhabricatorInlineComment$comment
Return
wild

private function loadCache()

This method is not documented.
Return
wild

protected static function getCacheableProperties()

This method is not documented.
Return
wild

public function saveCache()

This method is not documented.
Return
wild

private function markGenerated($new_corpus_block)

This method is not documented.
Parameters
$new_corpus_block
Return
wild

public function isGenerated()

This method is not documented.
Return
wild

public function isDeleted()

This method is not documented.
Return
wild

public function isUnchanged()

This method is not documented.
Return
wild

public function isMoveAway()

This method is not documented.
Return
wild

private function applyIntraline(&$render, $intra, $corpus)

This method is not documented.
Parameters
&$render
$intra
$corpus
Return
wild

private function getHighlightFuture($corpus)

This method is not documented.
Parameters
$corpus
Return
wild

protected function processHighlightedSource($data, $result)

This method is not documented.
Parameters
$data
$result
Return
wild

private function tryCacheStuff()

This method is not documented.
Return
wild

private function process()

This method is not documented.
Return
wild

private function shouldRenderPropertyChangeHeader($changeset)

This method is not documented.
Parameters
$changeset
Return
wild

public function render($range_start, $range_len, $mask_force)

This method is not documented.
Parameters
$range_start
$range_len
$mask_force
Return
wild

private function calculateGapsAndMask($mask_force, $feedback_mask, $range_start, $range_len)

This function calculates a lot of stuff we need to know to display the diff:

Gaps - compute gaps in the visible display diff, where we will render "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 "show more context" element instead of diff text below. A given $gap is a tuple of $gap_line_number_start and $gap_length.

Mask - compute the actual lines that need to be shown (because they are near changes lines, near inline comments, or the request has explicitly asked for them, i.e. resulting from the user clicking "show more"). The $mask returned is a sparsely populated dictionary of $visible_line_number => true.

Parameters
$mask_force
$feedback_mask
$range_start
$range_len
Return
array($gaps, $mask)

private function isCommentVisibleOnRenderedDiff($comment)

Determine if an inline comment will appear on the rendered diff, taking into consideration which halves of which changesets will actually be shown.

Parameters
PhabricatorInlineComment$commentComment to test for visibility.
Return
boolTrue if the comment is visible on the rendered diff.

private function isCommentOnRightSideWhenDisplayed($comment)

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 per isCommentVisibleOnRenderedDiff().

Parameters
PhabricatorInlineComment$commentComment to test for display location.
Return
boolTrue for right, false for left.

public static function parseRangeSpecification($spec)

Parse the 'range' specification that this class and the client-side JS emit to indicate that a user clicked "Show more..." on a diff. Generally, use is something like this:

$spec = $request->getStr('range');
$parsed = DifferentialChangesetParser::parseRangeSpecification($spec);
list($start, $end, $mask) = $parsed;
$parser->render($start, $end, $mask);
Parameters
string$specRange specification, indicating the range of the diff that should be rendered.
Return
tupleList of <start, end, mask> suitable for passing to @{method:render}.

public function renderModifiedCoverage()

Render "modified coverage" information; test coverage on modified lines. This synthesizes diff information with unit test information into a useful indicator of how well tested a change is.

Return
wild

private function buildLineBackmaps()

Build maps from lines comments appear on to actual lines.

Return
wild

private function getOffset($map, $line)

This method is not documented.
Parameters
array$map
$line
Return
wild

private function realignDiff($changeset, $hunk_parser)

This method is not documented.
Parameters
DifferentialChangeset$changeset
DifferentialHunkParser$hunk_parser
Return
wild

private function adjustRenderedLineForDisplay($line)

This method is not documented.
Parameters
$line
Return
wild

private function newSuspiciousCharacterRules()

This method is not documented.
Return
wild

public static function replaceTabsWithSpaces($line, $tab_width)

This method is not documented.
Parameters
$line
$tab_width
Return
wild

private function newDocumentEngine()

This method is not documented.
Return
wild

private function loadFileObjectsForChangeset()

This method is not documented.
Return
wild

public function newChangesetResponse()

This method is not documented.
Return
wild

private function getRawDocumentEngineData($lines)

This method is not documented.
Parameters
array$lines
Return
wild