1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

fix differential + diffusion for showing generated files

Summary: in the re-factor quest this got broken. Turns out NewLines (aka $this->new in the parser) gets updated right up until the very end for showing text changes so instead pass over the total line count to the renderer to get this codepath right.

Test Plan: showed content of some generated files in diffusion and all was well

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2204

Differential Revision: https://secure.phabricator.com/D4237
This commit is contained in:
Bob Trahan 2012-12-19 10:56:00 -08:00
parent b8d372c4bc
commit fcc5366eff
2 changed files with 15 additions and 7 deletions

View file

@ -972,9 +972,14 @@ final class DifferentialChangesetParser {
$this->tryCacheStuff();
$render_pch = $this->shouldRenderPropertyChangeHeader($this->changeset);
$rows = max(
count($this->old),
count($this->new));
$renderer = id(new DifferentialChangesetTwoUpRenderer())
->setChangeset($this->changeset)
->setRenderPropertyChangeHeader($render_pch)
->setLineCount($rows)
->setOldRender($this->oldRender)
->setNewRender($this->newRender)
->setMissingOldLines($this->missingOld)
@ -1156,9 +1161,6 @@ final class DifferentialChangesetParser {
->setOriginalOld($this->originalLeft)
->setOriginalNew($this->originalRight);
$rows = max(
count($this->old),
count($this->new));
if ($range_start === null) {
$range_start = 0;
}

View file

@ -28,6 +28,15 @@ abstract class DifferentialChangesetRenderer {
private $gaps;
private $mask;
private $depths;
private $lineCount;
public function setLineCount($line_count) {
$this->lineCount = $line_count;
return $this;
}
public function getLineCount() {
return $this->lineCount;
}
public function setDepths($depths) {
$this->depths = $depths;
@ -260,10 +269,7 @@ abstract class DifferentialChangesetRenderer {
public function renderShield($message, $more) {
if ($more) {
$end = max(
count($this->getOldLines()),
count($this->getNewLines())
);
$end = $this->getLineCount();
$reference = $this->getRenderingReference();
$more =
' '.