From ef3b097a41045d97c60b4d1dd43b503cf0ed5960 Mon Sep 17 00:00:00 2001 From: Alan Huang Date: Tue, 7 Aug 2012 18:53:22 -0700 Subject: [PATCH] Fix "show raw file" showing wrong file Summary: In a revision with multiple diffs like https://secure.phabricator.com/D3168?vs=6094&id=6095 clicking "Show Raw File (Left)" while comparing diffs 1 and 2 brings up the version from base, instead of from diff 1. This is because the hunks are stored as diffs between base and diff X, and the raw file is generated from the hunks. This introduces a hack which is probably not actually correct but seems to work for the 90% case. (The "Show Raw File (Right)" button was and remains correct.) Test Plan: Click raw file buttons while comparing different diffs. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3169 --- .../controller/DifferentialChangesetViewController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index e5cf98fbc6..73f03d8cd4 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -55,6 +55,13 @@ final class DifferentialChangesetViewController extends DifferentialController { case 'new': return $this->buildRawFileResponse($changeset, $is_new = true); case 'old': + if ($vs && ($vs != -1)) { + $vs_changeset = id(new DifferentialChangeset())->load($vs); + if ($vs_changeset) { + $vs_changeset->attachHunks($vs_changeset->loadHunks()); + return $this->buildRawFileResponse($vs_changeset, $is_new = true); + } + } return $this->buildRawFileResponse($changeset, $is_new = false); default: return new Aphront400Response();