diff --git a/src/applications/differential/__tests__/data/order.diff b/src/applications/differential/__tests__/data/order.diff new file mode 100644 --- /dev/null +++ b/src/applications/differential/__tests__/data/order.diff @@ -0,0 +1,24 @@ +diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController b/src/applications/conpherence/controller/ConpherenceUpdateController +--- a/src/applications/conpherence/controller/ConpherenceUpdateController ++++ b/src/applications/conpherence/controller/ConpherenceUpdateController +@@ -209,14 +209,19 @@ + ->setDatasource(new PhabricatorPeopleDatasource())); + + require_celerity_resource('conpherence-update-css'); +- return id(new AphrontDialogView()) ++ $view = id(new AphrontDialogView()) + ->setTitle(pht('Add Participants')) + ->addHiddenInput('action', 'add_person') + ->addHiddenInput( + 'latest_transaction_id', + $request->getInt('latest_transaction_id')) + ->appendChild($form); ++ ++ if ($request->getExists('minimal_display')) { ++ $view->addHiddenInput('minimal_display', true); + } ++ return $view; ++ } + + private function renderRemovePersonDialogue( + ConpherenceThread $conpherence) { diff --git a/src/applications/differential/__tests__/data/order.diff.one.expect b/src/applications/differential/__tests__/data/order.diff.one.expect new file mode 100644 --- /dev/null +++ b/src/applications/differential/__tests__/data/order.diff.one.expect @@ -0,0 +1,26 @@ +CTYPE 2 1 (unforced) +src/applications/conpherence/controller/ConpherenceUpdateController +src/applications/conpherence/controller/ConpherenceUpdateController +- +X +N 209 . ->setDatasource(new PhabricatorPeopleDatasource()));\n~ +N 210 . \n~ +N 211 . require_celerity_resource('conpherence-update-css');\n~ +O 212 - {(return)} id(new AphrontDialogView())\n~ +N 212 + {($view =)} id(new AphrontDialogView())\n~ +N 213 . ->setTitle(pht('Add Participants'))\n~ +N 214 . ->addHiddenInput('action', 'add_person')\n~ +N 215 . ->addHiddenInput(\n~ +N 216 . 'latest_transaction_id',\n~ +N 217 . $request->getInt('latest_transaction_id'))\n~ +N 218 . ->appendChild($form);\n~ +N 219 + \n~ +N 220 + if ($request->getExists('minimal_display')) {\n~ +N 221 + $view->addHiddenInput('minimal_display', true);\n~ +N 222 . }\n~ +N 223 + return $view;\n~ +N 224 + }\n~ +N 225 . \n~ +N 226 . private function renderRemovePersonDialogue(\n~ +N 227 . ConpherenceThread $conpherence) {\n~ +X diff --git a/src/applications/differential/__tests__/data/order.diff.two.expect b/src/applications/differential/__tests__/data/order.diff.two.expect new file mode 100644 --- /dev/null +++ b/src/applications/differential/__tests__/data/order.diff.two.expect @@ -0,0 +1,44 @@ +CTYPE 2 1 (unforced) +src/applications/conpherence/controller/ConpherenceUpdateController +src/applications/conpherence/controller/ConpherenceUpdateController +- +X +O 209 . ->setDatasource(new PhabricatorPeopleDatasource()));\n~ +N 209 . ->setDatasource(new PhabricatorPeopleDatasource()));\n~ +O 210 . \n~ +N 210 . \n~ +O 211 . require_celerity_resource('conpherence-update-css');\n~ +N 211 . require_celerity_resource('conpherence-update-css');\n~ +O 212 - {(return)} id(new AphrontDialogView())\n~ +N 212 + {($view =)} id(new AphrontDialogView())\n~ +O 213 . ->setTitle(pht('Add Participants'))\n~ +N 213 . ->setTitle(pht('Add Participants'))\n~ +O 214 . ->addHiddenInput('action', 'add_person')\n~ +N 214 . ->addHiddenInput('action', 'add_person')\n~ +O 215 . ->addHiddenInput(\n~ +N 215 . ->addHiddenInput(\n~ +O 216 . 'latest_transaction_id',\n~ +N 216 . 'latest_transaction_id',\n~ +O 217 . $request->getInt('latest_transaction_id'))\n~ +N 217 . $request->getInt('latest_transaction_id'))\n~ +O 218 . ->appendChild($form);\n~ +N 218 . ->appendChild($form);\n~ +O - . ~ +N 219 + \n~ +O - . ~ +N 220 + if ($request->getExists('minimal_display')) {\n~ +O - . ~ +N 221 + $view->addHiddenInput('minimal_display', true);\n~ +O 219 . }\n~ +N 222 . }\n~ +O - . ~ +N 223 + return $view;\n~ +O - . ~ +N 224 + }\n~ +O 220 . \n~ +N 225 . \n~ +O 221 . private function renderRemovePersonDialogue(\n~ +N 226 . private function renderRemovePersonDialogue(\n~ +O 222 . ConpherenceThread $conpherence) {\n~ +N 227 . ConpherenceThread $conpherence) {\n~ +X diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php --- a/src/applications/differential/render/DifferentialChangesetRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetRenderer.php @@ -522,6 +522,13 @@ // If this line is the same in both versions of the file, put it in // the old line buffer. This makes sure inlines on old, unchanged // lines end up in the right place. + + // First, we need to flush the new line buffer if there's anything + // in it. + if ($new_buf) { + $out[] = $new_buf; + $new_buf = array(); + } $old_buf[] = $primitive; } else { $new_buf[] = $primitive; diff --git a/src/applications/differential/render/DifferentialChangesetTestRenderer.php b/src/applications/differential/render/DifferentialChangesetTestRenderer.php --- a/src/applications/differential/render/DifferentialChangesetTestRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTestRenderer.php @@ -92,12 +92,15 @@ ), $render); - $render = html_entity_decode($render); + $render = html_entity_decode($render, ENT_QUOTES); $t = ($type == 'old') ? 'O' : 'N'; $out[] = "{$t} {$num} {$htype} {$render}~"; break; + case 'no-context': + $out[] = 'X '; + break; default: $out[] = $type; break;