1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

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
This commit is contained in:
Alan Huang 2012-08-07 18:53:22 -07:00
parent 523cba5da4
commit ef3b097a41

View file

@ -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();