Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/parser/DifferentialChangesetParser.php
Show First 20 Lines • Show All 862 Lines • ▼ Show 20 Lines | $renderer = $this->getRenderer() | ||||
->setNewLines($this->new) | ->setNewLines($this->new) | ||||
->setOriginalCharacterEncoding($encoding) | ->setOriginalCharacterEncoding($encoding) | ||||
->setShowEditAndReplyLinks($this->getShowEditAndReplyLinks()) | ->setShowEditAndReplyLinks($this->getShowEditAndReplyLinks()) | ||||
->setCanMarkDone($this->getCanMarkDone()) | ->setCanMarkDone($this->getCanMarkDone()) | ||||
->setObjectOwnerPHID($this->getObjectOwnerPHID()) | ->setObjectOwnerPHID($this->getObjectOwnerPHID()) | ||||
->setHighlightingDisabled($this->highlightingDisabled) | ->setHighlightingDisabled($this->highlightingDisabled) | ||||
->setDepthOnlyLines($this->getDepthOnlyLines()); | ->setDepthOnlyLines($this->getDepthOnlyLines()); | ||||
$engine_blocks = $this->newDocumentEngineBlocks(); | |||||
$has_document_engine = ($engine_blocks !== null); | |||||
$shield = null; | $shield = null; | ||||
if ($this->isTopLevel && !$this->comments) { | if ($this->isTopLevel && !$this->comments && !$has_document_engine) { | ||||
if ($this->isGenerated()) { | if ($this->isGenerated()) { | ||||
$shield = $renderer->renderShield( | $shield = $renderer->renderShield( | ||||
pht( | pht( | ||||
'This file contains generated code, which does not normally '. | 'This file contains generated code, which does not normally '. | ||||
'need to be reviewed.')); | 'need to be reviewed.')); | ||||
} else if ($this->isMoveAway()) { | } else if ($this->isMoveAway()) { | ||||
// We put an empty shield on these files. Normally, they do not have | // We put an empty shield on these files. Normally, they do not have | ||||
// any diff content anyway. However, if they come through `arc`, they | // any diff content anyway. However, if they come through `arc`, they | ||||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | if ($this->comments) { | ||||
$old_comments[$final][] = $comment; | $old_comments[$final][] = $comment; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$renderer | $renderer | ||||
->setOldComments($old_comments) | ->setOldComments($old_comments) | ||||
->setNewComments($new_comments); | ->setNewComments($new_comments); | ||||
$engine_blocks = $this->newDocumentEngineChangesetView(); | |||||
if ($engine_blocks !== null) { | if ($engine_blocks !== null) { | ||||
$reference = $this->getRenderingReference(); | $reference = $this->getRenderingReference(); | ||||
$parts = explode('/', $reference); | $parts = explode('/', $reference); | ||||
if (count($parts) == 2) { | if (count($parts) == 2) { | ||||
list($id, $vs) = $parts; | list($id, $vs) = $parts; | ||||
} else { | } else { | ||||
$id = $parts[0]; | $id = $parts[0]; | ||||
$vs = 0; | $vs = 0; | ||||
} | } | ||||
// If we don't have an explicit "vs" changeset, it's the left side of | // If we don't have an explicit "vs" changeset, it's the left side of | ||||
// the "id" changeset. | // the "id" changeset. | ||||
if (!$vs) { | if (!$vs) { | ||||
$vs = $id; | $vs = $id; | ||||
} | } | ||||
$renderer->setDocumentEngineBlocks($engine_blocks); | |||||
return $renderer->renderDocumentEngineBlocks( | return $renderer->renderDocumentEngineBlocks( | ||||
$engine_blocks, | $engine_blocks, | ||||
(string)$id, | (string)$id, | ||||
(string)$vs); | (string)$vs); | ||||
} | } | ||||
// If we've made it here with a type of file we don't know how to render, | // If we've made it here with a type of file we don't know how to render, | ||||
// bail out with a default empty rendering. Normally, we'd expect a | // bail out with a default empty rendering. Normally, we'd expect a | ||||
▲ Show 20 Lines • Show All 596 Lines • ▼ Show 20 Lines | if ($fast_path) { | ||||
} | } | ||||
$line = implode('', $line); | $line = implode('', $line); | ||||
} | } | ||||
return $prefix.$line; | return $prefix.$line; | ||||
} | } | ||||
private function newDocumentEngineChangesetView() { | private function newDocumentEngineBlocks() { | ||||
$changeset = $this->changeset; | $changeset = $this->changeset; | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
// TODO: This should probably be made non-optional in the future. | // TODO: This should probably be made non-optional in the future. | ||||
if (!$viewer) { | if (!$viewer) { | ||||
return null; | return null; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | if (strlen($engine_key)) { | ||||
} else { | } else { | ||||
$document_engine = null; | $document_engine = null; | ||||
} | } | ||||
} else { | } else { | ||||
$document_engine = head($shared_engines); | $document_engine = head($shared_engines); | ||||
} | } | ||||
if ($document_engine) { | if ($document_engine) { | ||||
return $document_engine->newDiffView( | return $document_engine->newEngineBlocks( | ||||
$old_ref, | $old_ref, | ||||
$new_ref); | $new_ref); | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
private function loadFileObjectsForChangeset() { | private function loadFileObjectsForChangeset() { | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |