Make Changeset ID for render cache explicit

Summary:
DifferentialChangesetParser currently takes the Changeset object to mean a bunch
of different and mutually conflicting things implicitly:

  - Changeset ID is used to access the render cache.
  - Changeset ID is also used to tell the ajax endpoint what to render when
clicking "show more".
  - Changeset object has the actual changes.
  - Changeset ID and "oldChangesetID" are used to choose where to show inline
comments and how to attach new ones.

This indirectly causes a bunch of problems, like T141 and T132. Move toward
making all these separate things explicit. I want to have the changeset object
only mean the actual changes to display.

Test Plan:
Looked at changesets and verified the render cache was accessed correctly (and
not accessed in other cases).

Reviewed By: tuomaspelkonen
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, epriestley, tuomaspelkonen
Differential Revision: 228
This commit is contained in:
epriestley
2011-05-05 07:08:10 -07:00
parent 85b09c5ccb
commit af06bfb1cc
2 changed files with 37 additions and 6 deletions

View File

@@ -48,6 +48,8 @@ class DifferentialChangesetViewController extends DifferentialController {
$right_new = true;
$left_source = $right->getID();
$left_new = false;
$render_cache_key = $right->getID();
} else if ($vs == -1) {
$right = null;
$left = $changeset;
@@ -56,6 +58,8 @@ class DifferentialChangesetViewController extends DifferentialController {
$right_new = false;
$left_source = $left->getID();
$left_new = true;
$render_cache_key = null;
} else {
$right = $changeset;
$left = $vs_changeset;
@@ -64,6 +68,8 @@ class DifferentialChangesetViewController extends DifferentialController {
$right_new = true;
$left_source = $left->getID();
$left_new = true;
$render_cache_key = null;
}
if ($left) {
@@ -130,6 +136,7 @@ class DifferentialChangesetViewController extends DifferentialController {
$parser = new DifferentialChangesetParser();
$parser->setChangeset($changeset);
$parser->setRenderCacheKey($render_cache_key);
$parser->setRightSideCommentMapping($right_source, $right_new);
$parser->setLeftSideCommentMapping($left_source, $left_new);
$parser->setWhitespaceMode($request->getStr('whitespace'));