@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Completely remove the legacy hunk table

Summary: Depends on D19056. Fixes T8475. Ref T13054. Merges "ModernHunk" back into "Hunk".

Test Plan: Grepped for `modernhunk`. Reviewed revisions. Created a new revision. Used `bin/differential migrate-hunk` to migrate hunks between storage formats and back.

Maniphest Tasks: T13054, T8475

Differential Revision: https://secure.phabricator.com/D19057

+267 -296
+2 -2
resources/sql/autopatches/20161213.diff.01.hunks.php
··· 25 25 $row['oldLen'], 26 26 $row['newOffset'], 27 27 $row['newLen'], 28 - DifferentialModernHunk::DATATYPE_TEXT, 28 + DifferentialHunk::DATATYPE_TEXT, 29 29 'utf8', 30 - DifferentialModernHunk::DATAFORMAT_RAW, 30 + DifferentialHunk::DATAFORMAT_RAW, 31 31 // In rare cases, this could be NULL. See T12090. 32 32 (string)$row['changes'], 33 33 $row['dateCreated'],
+2
resources/sql/autopatches/20180210.hunk.02.renamemodern.sql
··· 1 + RENAME TABLE {$NAMESPACE}_differential.differential_hunk_modern 2 + TO {$NAMESPACE}_differential.differential_hunk;
-2
src/__phutil_library_map__.php
··· 489 489 'DifferentialMailEngineExtension' => 'applications/differential/engineextension/DifferentialMailEngineExtension.php', 490 490 'DifferentialMailView' => 'applications/differential/mail/DifferentialMailView.php', 491 491 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php', 492 - 'DifferentialModernHunk' => 'applications/differential/storage/DifferentialModernHunk.php', 493 492 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 494 493 'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php', 495 494 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', ··· 5651 5650 'DifferentialMailEngineExtension' => 'PhabricatorMailEngineExtension', 5652 5651 'DifferentialMailView' => 'Phobject', 5653 5652 'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField', 5654 - 'DifferentialModernHunk' => 'DifferentialHunk', 5655 5653 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 5656 5654 'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod', 5657 5655 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',
+2 -2
src/applications/differential/engine/DifferentialDiffExtractionEngine.php
··· 217 217 // -echo "test"; 218 218 // -(empty line) 219 219 220 - $hunk = id(new DifferentialModernHunk())->setChanges($context); 221 - $vs_hunk = id(new DifferentialModernHunk())->setChanges($vs_context); 220 + $hunk = id(new DifferentialHunk())->setChanges($context); 221 + $vs_hunk = id(new DifferentialHunk())->setChanges($vs_context); 222 222 if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() || 223 223 $hunk->makeNewFile() != $vs_hunk->makeNewFile()) { 224 224 return true;
+5 -5
src/applications/differential/management/PhabricatorDifferentialMigrateHunkWorkflow.php
··· 32 32 33 33 $storage = $args->getArg('to'); 34 34 switch ($storage) { 35 - case DifferentialModernHunk::DATATYPE_TEXT: 36 - case DifferentialModernHunk::DATATYPE_FILE: 35 + case DifferentialHunk::DATATYPE_TEXT: 36 + case DifferentialHunk::DATATYPE_FILE: 37 37 break; 38 38 default: 39 39 throw new PhutilArgumentUsageException( ··· 44 44 $old_data = $hunk->getChanges(); 45 45 46 46 switch ($storage) { 47 - case DifferentialModernHunk::DATATYPE_TEXT: 47 + case DifferentialHunk::DATATYPE_TEXT: 48 48 $hunk->saveAsText(); 49 49 $this->logOkay( 50 50 pht('TEXT'), 51 51 pht('Convereted hunk to text storage.')); 52 52 break; 53 - case DifferentialModernHunk::DATATYPE_FILE: 53 + case DifferentialHunk::DATATYPE_FILE: 54 54 $hunk->saveAsFile(); 55 55 $this->logOkay( 56 56 pht('FILE'), ··· 71 71 } 72 72 73 73 private function loadHunk($id) { 74 - $hunk = id(new DifferentialModernHunk())->load($id); 74 + $hunk = id(new DifferentialHunk())->load($id); 75 75 if (!$hunk) { 76 76 throw new PhutilArgumentUsageException( 77 77 pht(
+2 -2
src/applications/differential/parser/__tests__/DifferentialChangesetParserTestCase.php
··· 3 3 final class DifferentialChangesetParserTestCase extends PhabricatorTestCase { 4 4 5 5 public function testDiffChangesets() { 6 - $hunk = new DifferentialModernHunk(); 6 + $hunk = new DifferentialHunk(); 7 7 $hunk->setChanges("+a\n b\n-c"); 8 8 $hunk->setNewOffset(1); 9 9 $hunk->setNewLen(2); ··· 20 20 ); 21 21 22 22 foreach ($tests as $changes => $expected) { 23 - $hunk = new DifferentialModernHunk(); 23 + $hunk = new DifferentialHunk(); 24 24 $hunk->setChanges($changes); 25 25 $hunk->setNewOffset(11); 26 26 $hunk->setNewLen(3);
+1 -1
src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
··· 14 14 $new_len, 15 15 $changes) { 16 16 17 - $hunk = id(new DifferentialModernHunk()) 17 + $hunk = id(new DifferentialHunk()) 18 18 ->setOldOffset($old_offset) 19 19 ->setOldLen($old_len) 20 20 ->setNewOffset($new_offset)
+9 -24
src/applications/differential/query/DifferentialHunkQuery.php
··· 30 30 } 31 31 } 32 32 33 + public function newResultObject() { 34 + return new DifferentialHunk(); 35 + } 36 + 33 37 protected function loadPage() { 34 - $all_results = array(); 35 - 36 - // Load modern hunks. 37 - $table = new DifferentialModernHunk(); 38 - $conn_r = $table->establishConnection('r'); 39 - 40 - $modern_data = queryfx_all( 41 - $conn_r, 42 - 'SELECT * FROM %T %Q %Q %Q', 43 - $table->getTableName(), 44 - $this->buildWhereClause($conn_r), 45 - $this->buildOrderClause($conn_r), 46 - $this->buildLimitClause($conn_r)); 47 - $modern_results = $table->loadAllFromArray($modern_data); 48 - 49 - // Strip all the IDs off since they're not unique and nothing should be 50 - // using them. 51 - return array_values($modern_results); 38 + return $this->loadStandardPage($this->newResultObject()); 52 39 } 53 40 54 41 protected function willFilterPage(array $hunks) { ··· 76 63 return $hunks; 77 64 } 78 65 79 - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 80 - $where = array(); 66 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 67 + $where = parent::buildWhereClauseParts($conn); 81 68 82 69 if (!$this->changesets) { 83 70 throw new Exception( ··· 87 74 } 88 75 89 76 $where[] = qsprintf( 90 - $conn_r, 77 + $conn, 91 78 'changesetID IN (%Ld)', 92 79 mpull($this->changesets, 'getID')); 93 80 94 - $where[] = $this->buildPagingClause($conn_r); 95 - 96 - return $this->formatWhereClause($where); 81 + return $where; 97 82 } 98 83 99 84 public function getQueryApplicationClass() {
+4 -4
src/applications/differential/storage/DifferentialChangeset.php
··· 118 118 public function delete() { 119 119 $this->openTransaction(); 120 120 121 - $modern_hunks = id(new DifferentialModernHunk())->loadAllWhere( 121 + $hunks = id(new DifferentialHunk())->loadAllWhere( 122 122 'changesetID = %d', 123 123 $this->getID()); 124 - foreach ($modern_hunks as $modern_hunk) { 125 - $modern_hunk->delete(); 124 + foreach ($hunks as $hunk) { 125 + $hunk->delete(); 126 126 } 127 127 128 128 $this->unsavedHunks = array(); ··· 292 292 PhabricatorDestructionEngine $engine) { 293 293 $this->openTransaction(); 294 294 295 - $hunks = id(new DifferentialModernHunk())->loadAllWhere( 295 + $hunks = id(new DifferentialHunk())->loadAllWhere( 296 296 'changesetID = %d', 297 297 $this->getID()); 298 298 foreach ($hunks as $hunk) {
+1 -1
src/applications/differential/storage/DifferentialDiff.php
··· 189 189 $hunks = $change->getHunks(); 190 190 if ($hunks) { 191 191 foreach ($hunks as $hunk) { 192 - $dhunk = new DifferentialModernHunk(); 192 + $dhunk = new DifferentialHunk(); 193 193 $dhunk->setOldOffset($hunk->getOldOffset()); 194 194 $dhunk->setOldLen($hunk->getOldLength()); 195 195 $dhunk->setNewOffset($hunk->getNewOffset());
+237 -2
src/applications/differential/storage/DifferentialHunk.php
··· 1 1 <?php 2 2 3 - abstract class DifferentialHunk 3 + final class DifferentialHunk 4 4 extends DifferentialDAO 5 5 implements 6 6 PhabricatorPolicyInterface, ··· 11 11 protected $oldLen; 12 12 protected $newOffset; 13 13 protected $newLen; 14 + protected $dataType; 15 + protected $dataEncoding; 16 + protected $dataFormat; 17 + protected $data; 14 18 15 19 private $changeset; 16 20 private $splitLines; 17 21 private $structuredLines; 18 22 private $structuredFiles = array(); 19 23 24 + private $rawData; 25 + private $forcedEncoding; 26 + private $fileData; 27 + 20 28 const FLAG_LINES_ADDED = 1; 21 29 const FLAG_LINES_REMOVED = 2; 22 30 const FLAG_LINES_STABLE = 4; 31 + 32 + const DATATYPE_TEXT = 'text'; 33 + const DATATYPE_FILE = 'file'; 34 + 35 + const DATAFORMAT_RAW = 'byte'; 36 + const DATAFORMAT_DEFLATED = 'gzde'; 37 + 38 + protected function getConfiguration() { 39 + return array( 40 + self::CONFIG_BINARY => array( 41 + 'data' => true, 42 + ), 43 + self::CONFIG_COLUMN_SCHEMA => array( 44 + 'dataType' => 'bytes4', 45 + 'dataEncoding' => 'text16?', 46 + 'dataFormat' => 'bytes4', 47 + 'oldOffset' => 'uint32', 48 + 'oldLen' => 'uint32', 49 + 'newOffset' => 'uint32', 50 + 'newLen' => 'uint32', 51 + ), 52 + self::CONFIG_KEY_SCHEMA => array( 53 + 'key_changeset' => array( 54 + 'columns' => array('changesetID'), 55 + ), 56 + 'key_created' => array( 57 + 'columns' => array('dateCreated'), 58 + ), 59 + ), 60 + ) + parent::getConfiguration(); 61 + } 23 62 24 63 public function getAddedLines() { 25 64 return $this->makeContent($include = '+'); ··· 214 253 } 215 254 216 255 256 + /* -( Storage )------------------------------------------------------------ */ 257 + 258 + 259 + public function setChanges($text) { 260 + $this->rawData = $text; 261 + 262 + $this->dataEncoding = $this->detectEncodingForStorage($text); 263 + $this->dataType = self::DATATYPE_TEXT; 264 + 265 + list($format, $data) = $this->formatDataForStorage($text); 266 + 267 + $this->dataFormat = $format; 268 + $this->data = $data; 269 + 270 + return $this; 271 + } 272 + 273 + public function getChanges() { 274 + return $this->getUTF8StringFromStorage( 275 + $this->getRawData(), 276 + nonempty($this->forcedEncoding, $this->getDataEncoding())); 277 + } 278 + 279 + public function forceEncoding($encoding) { 280 + $this->forcedEncoding = $encoding; 281 + return $this; 282 + } 283 + 284 + private function formatDataForStorage($data) { 285 + $deflated = PhabricatorCaches::maybeDeflateData($data); 286 + if ($deflated !== null) { 287 + return array(self::DATAFORMAT_DEFLATED, $deflated); 288 + } 289 + 290 + return array(self::DATAFORMAT_RAW, $data); 291 + } 292 + 293 + public function saveAsText() { 294 + $old_type = $this->getDataType(); 295 + $old_data = $this->getData(); 296 + 297 + if ($old_type == self::DATATYPE_TEXT) { 298 + return $this; 299 + } 300 + 301 + $raw_data = $this->getRawData(); 302 + 303 + $this->setDataType(self::DATATYPE_TEXT); 304 + 305 + list($format, $data) = $this->formatDataForStorage($raw_data); 306 + $this->setDataFormat($format); 307 + $this->setData($data); 308 + 309 + $result = $this->save(); 310 + 311 + $this->destroyData($old_type, $old_data); 312 + 313 + return $result; 314 + } 315 + 316 + public function saveAsFile() { 317 + $old_type = $this->getDataType(); 318 + $old_data = $this->getData(); 319 + 320 + if ($old_type == self::DATATYPE_FILE) { 321 + return $this; 322 + } 323 + 324 + $raw_data = $this->getRawData(); 325 + 326 + list($format, $data) = $this->formatDataForStorage($raw_data); 327 + $this->setDataFormat($format); 328 + 329 + $file = PhabricatorFile::newFromFileData( 330 + $data, 331 + array( 332 + 'name' => 'differential-hunk', 333 + 'mime-type' => 'application/octet-stream', 334 + 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 335 + )); 336 + 337 + $this->setDataType(self::DATATYPE_FILE); 338 + $this->setData($file->getPHID()); 339 + 340 + // NOTE: Because hunks don't have a PHID and we just load hunk data with 341 + // the omnipotent viewer, we do not need to attach the file to anything. 342 + 343 + $result = $this->save(); 344 + 345 + $this->destroyData($old_type, $old_data); 346 + 347 + return $result; 348 + } 349 + 350 + private function getRawData() { 351 + if ($this->rawData === null) { 352 + $type = $this->getDataType(); 353 + $data = $this->getData(); 354 + 355 + switch ($type) { 356 + case self::DATATYPE_TEXT: 357 + // In this storage type, the changes are stored on the object. 358 + $data = $data; 359 + break; 360 + case self::DATATYPE_FILE: 361 + $data = $this->loadFileData(); 362 + break; 363 + default: 364 + throw new Exception( 365 + pht('Hunk has unsupported data type "%s"!', $type)); 366 + } 367 + 368 + $format = $this->getDataFormat(); 369 + switch ($format) { 370 + case self::DATAFORMAT_RAW: 371 + // In this format, the changes are stored as-is. 372 + $data = $data; 373 + break; 374 + case self::DATAFORMAT_DEFLATED: 375 + $data = PhabricatorCaches::inflateData($data); 376 + break; 377 + default: 378 + throw new Exception( 379 + pht('Hunk has unsupported data encoding "%s"!', $type)); 380 + } 381 + 382 + $this->rawData = $data; 383 + } 384 + 385 + return $this->rawData; 386 + } 387 + 388 + private function loadFileData() { 389 + if ($this->fileData === null) { 390 + $type = $this->getDataType(); 391 + if ($type !== self::DATATYPE_FILE) { 392 + throw new Exception( 393 + pht( 394 + 'Unable to load file data for hunk with wrong data type ("%s").', 395 + $type)); 396 + } 397 + 398 + $file_phid = $this->getData(); 399 + 400 + $file = $this->loadRawFile($file_phid); 401 + $data = $file->loadFileData(); 402 + 403 + $this->fileData = $data; 404 + } 405 + 406 + return $this->fileData; 407 + } 408 + 409 + private function loadRawFile($file_phid) { 410 + $viewer = PhabricatorUser::getOmnipotentUser(); 411 + 412 + 413 + $files = id(new PhabricatorFileQuery()) 414 + ->setViewer($viewer) 415 + ->withPHIDs(array($file_phid)) 416 + ->execute(); 417 + if (!$files) { 418 + throw new Exception( 419 + pht( 420 + 'Failed to load file ("%s") with hunk data.', 421 + $file_phid)); 422 + } 423 + 424 + $file = head($files); 425 + 426 + return $file; 427 + } 428 + 429 + private function destroyData( 430 + $type, 431 + $data, 432 + PhabricatorDestructionEngine $engine = null) { 433 + 434 + if (!$engine) { 435 + $engine = new PhabricatorDestructionEngine(); 436 + } 437 + 438 + switch ($type) { 439 + case self::DATATYPE_FILE: 440 + $file = $this->loadRawFile($data); 441 + $engine->destroyObject($file); 442 + break; 443 + } 444 + } 445 + 446 + 217 447 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 218 448 219 449 ··· 237 467 238 468 public function destroyObjectPermanently( 239 469 PhabricatorDestructionEngine $engine) { 470 + 471 + $type = $this->getDataType(); 472 + $data = $this->getData(); 473 + 474 + $this->destroyData($type, $data, $engine); 475 + 240 476 $this->delete(); 241 477 } 242 - 243 478 244 479 }
-249
src/applications/differential/storage/DifferentialModernHunk.php
··· 1 - <?php 2 - 3 - final class DifferentialModernHunk extends DifferentialHunk { 4 - 5 - const DATATYPE_TEXT = 'text'; 6 - const DATATYPE_FILE = 'file'; 7 - 8 - const DATAFORMAT_RAW = 'byte'; 9 - const DATAFORMAT_DEFLATED = 'gzde'; 10 - 11 - protected $dataType; 12 - protected $dataEncoding; 13 - protected $dataFormat; 14 - protected $data; 15 - 16 - private $rawData; 17 - private $forcedEncoding; 18 - private $fileData; 19 - 20 - public function getTableName() { 21 - return 'differential_hunk_modern'; 22 - } 23 - 24 - protected function getConfiguration() { 25 - return array( 26 - self::CONFIG_BINARY => array( 27 - 'data' => true, 28 - ), 29 - self::CONFIG_COLUMN_SCHEMA => array( 30 - 'dataType' => 'bytes4', 31 - 'dataEncoding' => 'text16?', 32 - 'dataFormat' => 'bytes4', 33 - 'oldOffset' => 'uint32', 34 - 'oldLen' => 'uint32', 35 - 'newOffset' => 'uint32', 36 - 'newLen' => 'uint32', 37 - ), 38 - self::CONFIG_KEY_SCHEMA => array( 39 - 'key_changeset' => array( 40 - 'columns' => array('changesetID'), 41 - ), 42 - 'key_created' => array( 43 - 'columns' => array('dateCreated'), 44 - ), 45 - ), 46 - ) + parent::getConfiguration(); 47 - } 48 - 49 - public function setChanges($text) { 50 - $this->rawData = $text; 51 - 52 - $this->dataEncoding = $this->detectEncodingForStorage($text); 53 - $this->dataType = self::DATATYPE_TEXT; 54 - 55 - list($format, $data) = $this->formatDataForStorage($text); 56 - 57 - $this->dataFormat = $format; 58 - $this->data = $data; 59 - 60 - return $this; 61 - } 62 - 63 - public function getChanges() { 64 - return $this->getUTF8StringFromStorage( 65 - $this->getRawData(), 66 - nonempty($this->forcedEncoding, $this->getDataEncoding())); 67 - } 68 - 69 - public function forceEncoding($encoding) { 70 - $this->forcedEncoding = $encoding; 71 - return $this; 72 - } 73 - 74 - private function formatDataForStorage($data) { 75 - $deflated = PhabricatorCaches::maybeDeflateData($data); 76 - if ($deflated !== null) { 77 - return array(self::DATAFORMAT_DEFLATED, $deflated); 78 - } 79 - 80 - return array(self::DATAFORMAT_RAW, $data); 81 - } 82 - 83 - public function saveAsText() { 84 - $old_type = $this->getDataType(); 85 - $old_data = $this->getData(); 86 - 87 - if ($old_type == self::DATATYPE_TEXT) { 88 - return $this; 89 - } 90 - 91 - $raw_data = $this->getRawData(); 92 - 93 - $this->setDataType(self::DATATYPE_TEXT); 94 - 95 - list($format, $data) = $this->formatDataForStorage($raw_data); 96 - $this->setDataFormat($format); 97 - $this->setData($data); 98 - 99 - $result = $this->save(); 100 - 101 - $this->destroyData($old_type, $old_data); 102 - 103 - return $result; 104 - } 105 - 106 - public function saveAsFile() { 107 - $old_type = $this->getDataType(); 108 - $old_data = $this->getData(); 109 - 110 - if ($old_type == self::DATATYPE_FILE) { 111 - return $this; 112 - } 113 - 114 - $raw_data = $this->getRawData(); 115 - 116 - list($format, $data) = $this->formatDataForStorage($raw_data); 117 - $this->setDataFormat($format); 118 - 119 - $file = PhabricatorFile::newFromFileData( 120 - $data, 121 - array( 122 - 'name' => 'differential-hunk', 123 - 'mime-type' => 'application/octet-stream', 124 - 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 125 - )); 126 - 127 - $this->setDataType(self::DATATYPE_FILE); 128 - $this->setData($file->getPHID()); 129 - 130 - // NOTE: Because hunks don't have a PHID and we just load hunk data with 131 - // the omnipotent viewer, we do not need to attach the file to anything. 132 - 133 - $result = $this->save(); 134 - 135 - $this->destroyData($old_type, $old_data); 136 - 137 - return $result; 138 - } 139 - 140 - private function getRawData() { 141 - if ($this->rawData === null) { 142 - $type = $this->getDataType(); 143 - $data = $this->getData(); 144 - 145 - switch ($type) { 146 - case self::DATATYPE_TEXT: 147 - // In this storage type, the changes are stored on the object. 148 - $data = $data; 149 - break; 150 - case self::DATATYPE_FILE: 151 - $data = $this->loadFileData(); 152 - break; 153 - default: 154 - throw new Exception( 155 - pht('Hunk has unsupported data type "%s"!', $type)); 156 - } 157 - 158 - $format = $this->getDataFormat(); 159 - switch ($format) { 160 - case self::DATAFORMAT_RAW: 161 - // In this format, the changes are stored as-is. 162 - $data = $data; 163 - break; 164 - case self::DATAFORMAT_DEFLATED: 165 - $data = PhabricatorCaches::inflateData($data); 166 - break; 167 - default: 168 - throw new Exception( 169 - pht('Hunk has unsupported data encoding "%s"!', $type)); 170 - } 171 - 172 - $this->rawData = $data; 173 - } 174 - 175 - return $this->rawData; 176 - } 177 - 178 - private function loadFileData() { 179 - if ($this->fileData === null) { 180 - $type = $this->getDataType(); 181 - if ($type !== self::DATATYPE_FILE) { 182 - throw new Exception( 183 - pht( 184 - 'Unable to load file data for hunk with wrong data type ("%s").', 185 - $type)); 186 - } 187 - 188 - $file_phid = $this->getData(); 189 - 190 - $file = $this->loadRawFile($file_phid); 191 - $data = $file->loadFileData(); 192 - 193 - $this->fileData = $data; 194 - } 195 - 196 - return $this->fileData; 197 - } 198 - 199 - private function loadRawFile($file_phid) { 200 - $viewer = PhabricatorUser::getOmnipotentUser(); 201 - 202 - 203 - $files = id(new PhabricatorFileQuery()) 204 - ->setViewer($viewer) 205 - ->withPHIDs(array($file_phid)) 206 - ->execute(); 207 - if (!$files) { 208 - throw new Exception( 209 - pht( 210 - 'Failed to load file ("%s") with hunk data.', 211 - $file_phid)); 212 - } 213 - 214 - $file = head($files); 215 - 216 - return $file; 217 - } 218 - 219 - 220 - public function destroyObjectPermanently( 221 - PhabricatorDestructionEngine $engine) { 222 - 223 - $type = $this->getDataType(); 224 - $data = $this->getData(); 225 - 226 - $this->destroyData($type, $data, $engine); 227 - 228 - return parent::destroyObjectPermanently($engine); 229 - } 230 - 231 - 232 - private function destroyData( 233 - $type, 234 - $data, 235 - PhabricatorDestructionEngine $engine = null) { 236 - 237 - if (!$engine) { 238 - $engine = new PhabricatorDestructionEngine(); 239 - } 240 - 241 - switch ($type) { 242 - case self::DATATYPE_FILE: 243 - $file = $this->loadRawFile($data); 244 - $engine->destroyObject($file); 245 - break; 246 - } 247 - } 248 - 249 - }
+2 -2
src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php
··· 5 5 public function testMakeChanges() { 6 6 $root = dirname(__FILE__).'/hunk/'; 7 7 8 - $hunk = new DifferentialModernHunk(); 8 + $hunk = new DifferentialHunk(); 9 9 $hunk->setChanges(Filesystem::readFile($root.'basic.diff')); 10 10 $hunk->setOldOffset(1); 11 11 $hunk->setNewOffset(11); ··· 23 23 ); 24 24 $this->assertEqual($added, $hunk->getAddedLines()); 25 25 26 - $hunk = new DifferentialModernHunk(); 26 + $hunk = new DifferentialHunk(); 27 27 $hunk->setChanges(Filesystem::readFile($root.'newline.diff')); 28 28 $hunk->setOldOffset(1); 29 29 $hunk->setNewOffset(11);