mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Rename DifferentialHunk
subclasses for consistency
Summary: Ref T5655. Test Plan: `arc lint` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D11470
This commit is contained in:
parent
fff0481184
commit
25ee2d4508
11 changed files with 20 additions and 20 deletions
|
@ -367,8 +367,6 @@ phutil_register_library_map(array(
|
|||
'DifferentialHostedMercurialLandingStrategy' => 'applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php',
|
||||
'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php',
|
||||
'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.php',
|
||||
'DifferentialHunkLegacy' => 'applications/differential/storage/DifferentialHunkLegacy.php',
|
||||
'DifferentialHunkModern' => 'applications/differential/storage/DifferentialHunkModern.php',
|
||||
'DifferentialHunkParser' => 'applications/differential/parser/DifferentialHunkParser.php',
|
||||
'DifferentialHunkParserTestCase' => 'applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php',
|
||||
'DifferentialHunkQuery' => 'applications/differential/query/DifferentialHunkQuery.php',
|
||||
|
@ -382,11 +380,13 @@ phutil_register_library_map(array(
|
|||
'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php',
|
||||
'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php',
|
||||
'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php',
|
||||
'DifferentialLegacyHunk' => 'applications/differential/storage/DifferentialLegacyHunk.php',
|
||||
'DifferentialLintField' => 'applications/differential/customfield/DifferentialLintField.php',
|
||||
'DifferentialLintStatus' => 'applications/differential/constants/DifferentialLintStatus.php',
|
||||
'DifferentialLocalCommitsView' => 'applications/differential/view/DifferentialLocalCommitsView.php',
|
||||
'DifferentialMail' => 'applications/differential/mail/DifferentialMail.php',
|
||||
'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php',
|
||||
'DifferentialModernHunk' => 'applications/differential/storage/DifferentialModernHunk.php',
|
||||
'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php',
|
||||
'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php',
|
||||
'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php',
|
||||
|
@ -3462,8 +3462,6 @@ phutil_register_library_map(array(
|
|||
'DifferentialDAO',
|
||||
'PhabricatorPolicyInterface',
|
||||
),
|
||||
'DifferentialHunkLegacy' => 'DifferentialHunk',
|
||||
'DifferentialHunkModern' => 'DifferentialHunk',
|
||||
'DifferentialHunkParserTestCase' => 'PhabricatorTestCase',
|
||||
'DifferentialHunkQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase',
|
||||
|
@ -3475,10 +3473,12 @@ phutil_register_library_map(array(
|
|||
'DifferentialInlineCommentView' => 'AphrontView',
|
||||
'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField',
|
||||
'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener',
|
||||
'DifferentialLegacyHunk' => 'DifferentialHunk',
|
||||
'DifferentialLintField' => 'DifferentialCustomField',
|
||||
'DifferentialLocalCommitsView' => 'AphrontView',
|
||||
'DifferentialMail' => 'PhabricatorMail',
|
||||
'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField',
|
||||
'DifferentialModernHunk' => 'DifferentialHunk',
|
||||
'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||
'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod',
|
||||
'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',
|
||||
|
|
|
@ -15,14 +15,14 @@ final class PhabricatorHunksManagementMigrateWorkflow
|
|||
$saw_any_rows = false;
|
||||
$console = PhutilConsole::getConsole();
|
||||
|
||||
$table = new DifferentialHunkLegacy();
|
||||
$table = new DifferentialLegacyHunk();
|
||||
foreach (new LiskMigrationIterator($table) as $hunk) {
|
||||
$saw_any_rows = true;
|
||||
|
||||
$id = $hunk->getID();
|
||||
$console->writeOut("%s\n", pht('Migrating hunk %d...', $id));
|
||||
|
||||
$new_hunk = id(new DifferentialHunkModern())
|
||||
$new_hunk = id(new DifferentialModernHunk())
|
||||
->setChangesetID($hunk->getChangesetID())
|
||||
->setOldOffset($hunk->getOldOffset())
|
||||
->setOldLen($hunk->getOldLen())
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
final class DifferentialChangesetParserTestCase extends PhabricatorTestCase {
|
||||
|
||||
public function testDiffChangesets() {
|
||||
$hunk = new DifferentialHunkModern();
|
||||
$hunk = new DifferentialModernHunk();
|
||||
$hunk->setChanges("+a\n b\n-c");
|
||||
$hunk->setNewOffset(1);
|
||||
$hunk->setNewLen(2);
|
||||
|
@ -20,7 +20,7 @@ final class DifferentialChangesetParserTestCase extends PhabricatorTestCase {
|
|||
);
|
||||
|
||||
foreach ($tests as $changes => $expected) {
|
||||
$hunk = new DifferentialHunkModern();
|
||||
$hunk = new DifferentialModernHunk();
|
||||
$hunk->setChanges($changes);
|
||||
$hunk->setNewOffset(11);
|
||||
$hunk->setNewLen(3);
|
||||
|
|
|
@ -14,7 +14,7 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase {
|
|||
$new_len,
|
||||
$changes) {
|
||||
|
||||
$hunk = id(new DifferentialHunkModern())
|
||||
$hunk = id(new DifferentialModernHunk())
|
||||
->setOldOffset($old_offset)
|
||||
->setOldLen($old_len)
|
||||
->setNewOffset($new_offset)
|
||||
|
|
|
@ -34,7 +34,7 @@ final class DifferentialHunkQuery
|
|||
$all_results = array();
|
||||
|
||||
// Load modern hunks.
|
||||
$table = new DifferentialHunkModern();
|
||||
$table = new DifferentialModernHunk();
|
||||
$conn_r = $table->establishConnection('r');
|
||||
|
||||
$modern_data = queryfx_all(
|
||||
|
@ -48,7 +48,7 @@ final class DifferentialHunkQuery
|
|||
|
||||
|
||||
// Now, load legacy hunks.
|
||||
$table = new DifferentialHunkLegacy();
|
||||
$table = new DifferentialLegacyHunk();
|
||||
$conn_r = $table->establishConnection('r');
|
||||
|
||||
$legacy_data = queryfx_all(
|
||||
|
|
|
@ -98,14 +98,14 @@ final class DifferentialChangeset extends DifferentialDAO
|
|||
public function delete() {
|
||||
$this->openTransaction();
|
||||
|
||||
$legacy_hunks = id(new DifferentialHunkLegacy())->loadAllWhere(
|
||||
$legacy_hunks = id(new DifferentialLegacyHunk())->loadAllWhere(
|
||||
'changesetID = %d',
|
||||
$this->getID());
|
||||
foreach ($legacy_hunks as $legacy_hunk) {
|
||||
$legacy_hunk->delete();
|
||||
}
|
||||
|
||||
$modern_hunks = id(new DifferentialHunkModern())->loadAllWhere(
|
||||
$modern_hunks = id(new DifferentialModernHunk())->loadAllWhere(
|
||||
'changesetID = %d',
|
||||
$this->getID());
|
||||
foreach ($modern_hunks as $modern_hunk) {
|
||||
|
|
|
@ -193,7 +193,7 @@ final class DifferentialDiff
|
|||
$hunks = $change->getHunks();
|
||||
if ($hunks) {
|
||||
foreach ($hunks as $hunk) {
|
||||
$dhunk = new DifferentialHunkModern();
|
||||
$dhunk = new DifferentialModernHunk();
|
||||
$dhunk->setOldOffset($hunk->getOldOffset());
|
||||
$dhunk->setOldLen($hunk->getOldLength());
|
||||
$dhunk->setNewOffset($hunk->getNewOffset());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
final class DifferentialHunkLegacy extends DifferentialHunk {
|
||||
final class DifferentialLegacyHunk extends DifferentialHunk {
|
||||
|
||||
protected $changes;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
final class DifferentialHunkModern extends DifferentialHunk {
|
||||
final class DifferentialModernHunk extends DifferentialHunk {
|
||||
|
||||
const DATATYPE_TEXT = 'text';
|
||||
const DATATYPE_FILE = 'file';
|
|
@ -5,7 +5,7 @@ final class DifferentialHunkTestCase extends ArcanistPhutilTestCase {
|
|||
public function testMakeChanges() {
|
||||
$root = dirname(__FILE__).'/hunk/';
|
||||
|
||||
$hunk = new DifferentialHunkModern();
|
||||
$hunk = new DifferentialModernHunk();
|
||||
$hunk->setChanges(Filesystem::readFile($root.'basic.diff'));
|
||||
$hunk->setOldOffset(1);
|
||||
$hunk->setNewOffset(11);
|
||||
|
@ -23,7 +23,7 @@ final class DifferentialHunkTestCase extends ArcanistPhutilTestCase {
|
|||
);
|
||||
$this->assertEqual($added, $hunk->getAddedLines());
|
||||
|
||||
$hunk = new DifferentialHunkModern();
|
||||
$hunk = new DifferentialModernHunk();
|
||||
$hunk->setChanges(Filesystem::readFile($root.'newline.diff'));
|
||||
$hunk->setOldOffset(1);
|
||||
$hunk->setNewOffset(11);
|
||||
|
|
|
@ -402,8 +402,8 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
|
|||
// -echo "test";
|
||||
// -(empty line)
|
||||
|
||||
$hunk = id(new DifferentialHunkModern())->setChanges($context);
|
||||
$vs_hunk = id(new DifferentialHunkModern())->setChanges($vs_context);
|
||||
$hunk = id(new DifferentialModernHunk())->setChanges($context);
|
||||
$vs_hunk = id(new DifferentialModernHunk())->setChanges($vs_context);
|
||||
if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() ||
|
||||
$hunk->makeNewFile() != $vs_hunk->makeNewFile()) {
|
||||
return $vs_diff;
|
||||
|
|
Loading…
Reference in a new issue