From 6eae75d8f2ffb7d5703e8d5e784d7a7c0499f563 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 25 Apr 2019 15:06:26 -0700 Subject: [PATCH] When building a synthetic diff in Differential, adjust diff properties correctly Summary: See PHI1218. When rendering "A vs B", we currently show the properties of diff A without modification. Instead, take properties from the same place we're taking change details. See T12664 for a followup. Test Plan: - In diff A, removed "+x" from a file. - In diff B, changed the file but did not remove "+x" from it. - Diffed B vs A. - Before change: UI incorrectly shows "+x" removed (both sides incorrect, just showing the change from diff A). - After change: UI shows 100644 -> null, which is half right. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20478 --- .../controller/DifferentialChangesetViewController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index 35793a2108..fe6163feb9 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -110,10 +110,13 @@ final class DifferentialChangesetViewController extends DifferentialController { if ($left) { $left_data = $left->makeNewFile(); + $left_properties = $left->getNewProperties(); if ($right) { $right_data = $right->makeNewFile(); + $right_properties = $right->getNewProperties(); } else { $right_data = $left->makeOldFile(); + $right_properties = $left->getOldProperties(); } $engine = new PhabricatorDifferenceEngine(); @@ -124,6 +127,9 @@ final class DifferentialChangesetViewController extends DifferentialController { $choice = clone nonempty($left, $right); $choice->attachHunks($synthetic->getHunks()); + $choice->setOldProperties($left_properties); + $choice->setNewProperties($right_properties); + $changeset = $choice; }