From aefc5654c3f9de85cc226ad64db36e604c62d197 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 26 Jul 2012 13:24:43 -0700 Subject: [PATCH] Load contents of shielded files with lots of changes Summary: We need `$this->old` and `$this->new` in `renderShield()`. Broken since D2358. Test Plan: Loaded contents of file with lots of changes. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3080 --- .../parser/DifferentialChangesetParser.php | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php index b32803e10c..8c8a97a667 100644 --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -941,40 +941,35 @@ final class DifferentialChangesetParser { $this->highlightEngine = PhabricatorSyntaxHighlighter::newEngine(); + $this->tryCacheStuff(); + $shield = null; - if ($this->isTopLevel && !$this->comments && - !($this->isGenerated() || $this->isUnchanged() || $this->isDeleted()) && - $this->changeset->getAffectedLineCount() > 2500) { - $lines = number_format($this->changeset->getAffectedLineCount()); - $shield = $this->renderShield( - "This file has a very large number of changes ({$lines} lines).", - true); - } else { - - $this->tryCacheStuff(); - - if ($this->isTopLevel && !$this->comments) { - if ($this->isGenerated()) { + if ($this->isTopLevel && !$this->comments) { + if ($this->isGenerated()) { + $shield = $this->renderShield( + "This file contains generated code, which does not normally need ". + "to be reviewed.", + true); + } else if ($this->isUnchanged()) { + if ($this->isWhitespaceOnly()) { $shield = $this->renderShield( - "This file contains generated code, which does not normally need ". - "to be reviewed.", - true); - } else if ($this->isUnchanged()) { - if ($this->isWhitespaceOnly()) { - $shield = $this->renderShield( - "This file was changed only by adding or removing trailing ". - "whitespace.", - false); - } else { - $shield = $this->renderShield( - "The contents of this file were not changed.", - false); - } - } else if ($this->isDeleted()) { + "This file was changed only by adding or removing trailing ". + "whitespace.", + false); + } else { $shield = $this->renderShield( - "This file was completely deleted.", - true); + "The contents of this file were not changed.", + false); } + } else if ($this->isDeleted()) { + $shield = $this->renderShield( + "This file was completely deleted.", + true); + } else if ($this->changeset->getAffectedLineCount() > 2500) { + $lines = number_format($this->changeset->getAffectedLineCount()); + $shield = $this->renderShield( + "This file has a very large number of changes ({$lines} lines).", + true); } }