1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Fix another issue with line order on unified diffs

Summary: This improves some cases with interleaved added and removed lines, and adds test coverage.

Test Plan:
  - Added and executed unit tests.
  - Viewed raw diff and saw sensible/expected output.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11992
This commit is contained in:
epriestley 2015-03-05 16:24:04 -08:00
parent c97040de47
commit b3d1ecebc7
5 changed files with 105 additions and 1 deletions

View file

@ -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) {

View file

@ -0,0 +1,26 @@
CTYPE 2 1 (unforced)
src/applications/conpherence/controller/ConpherenceUpdateController
src/applications/conpherence/controller/ConpherenceUpdateController
-
X <MISSING-CONTEXT>
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 <MISSING-CONTEXT>

View file

@ -0,0 +1,44 @@
CTYPE 2 1 (unforced)
src/applications/conpherence/controller/ConpherenceUpdateController
src/applications/conpherence/controller/ConpherenceUpdateController
-
X <MISSING-CONTEXT>
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 <MISSING-CONTEXT>

View file

@ -522,6 +522,13 @@ abstract class DifferentialChangesetRenderer {
// 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;

View file

@ -92,12 +92,15 @@ abstract class DifferentialChangesetTestRenderer
),
$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 <MISSING-CONTEXT>';
break;
default:
$out[] = $type;
break;