1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 10: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:
Joshua Spence 2015-01-23 07:17:04 +11:00
parent fff0481184
commit 25ee2d4508
11 changed files with 20 additions and 20 deletions

View file

@ -367,8 +367,6 @@ phutil_register_library_map(array(
'DifferentialHostedMercurialLandingStrategy' => 'applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php', 'DifferentialHostedMercurialLandingStrategy' => 'applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php',
'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php', 'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php',
'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.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', 'DifferentialHunkParser' => 'applications/differential/parser/DifferentialHunkParser.php',
'DifferentialHunkParserTestCase' => 'applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php', 'DifferentialHunkParserTestCase' => 'applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php',
'DifferentialHunkQuery' => 'applications/differential/query/DifferentialHunkQuery.php', 'DifferentialHunkQuery' => 'applications/differential/query/DifferentialHunkQuery.php',
@ -382,11 +380,13 @@ phutil_register_library_map(array(
'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php', 'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php',
'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php', 'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php',
'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php', 'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php',
'DifferentialLegacyHunk' => 'applications/differential/storage/DifferentialLegacyHunk.php',
'DifferentialLintField' => 'applications/differential/customfield/DifferentialLintField.php', 'DifferentialLintField' => 'applications/differential/customfield/DifferentialLintField.php',
'DifferentialLintStatus' => 'applications/differential/constants/DifferentialLintStatus.php', 'DifferentialLintStatus' => 'applications/differential/constants/DifferentialLintStatus.php',
'DifferentialLocalCommitsView' => 'applications/differential/view/DifferentialLocalCommitsView.php', 'DifferentialLocalCommitsView' => 'applications/differential/view/DifferentialLocalCommitsView.php',
'DifferentialMail' => 'applications/differential/mail/DifferentialMail.php', 'DifferentialMail' => 'applications/differential/mail/DifferentialMail.php',
'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php', 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php',
'DifferentialModernHunk' => 'applications/differential/storage/DifferentialModernHunk.php',
'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php',
'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php', 'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php',
'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php',
@ -3462,8 +3462,6 @@ phutil_register_library_map(array(
'DifferentialDAO', 'DifferentialDAO',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'DifferentialHunkLegacy' => 'DifferentialHunk',
'DifferentialHunkModern' => 'DifferentialHunk',
'DifferentialHunkParserTestCase' => 'PhabricatorTestCase', 'DifferentialHunkParserTestCase' => 'PhabricatorTestCase',
'DifferentialHunkQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DifferentialHunkQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase', 'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase',
@ -3475,10 +3473,12 @@ phutil_register_library_map(array(
'DifferentialInlineCommentView' => 'AphrontView', 'DifferentialInlineCommentView' => 'AphrontView',
'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField', 'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField',
'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener', 'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener',
'DifferentialLegacyHunk' => 'DifferentialHunk',
'DifferentialLintField' => 'DifferentialCustomField', 'DifferentialLintField' => 'DifferentialCustomField',
'DifferentialLocalCommitsView' => 'AphrontView', 'DifferentialLocalCommitsView' => 'AphrontView',
'DifferentialMail' => 'PhabricatorMail', 'DifferentialMail' => 'PhabricatorMail',
'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField', 'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField',
'DifferentialModernHunk' => 'DifferentialHunk',
'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector',
'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialParseRenderTestCase' => 'PhabricatorTestCase', 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',

View file

@ -15,14 +15,14 @@ final class PhabricatorHunksManagementMigrateWorkflow
$saw_any_rows = false; $saw_any_rows = false;
$console = PhutilConsole::getConsole(); $console = PhutilConsole::getConsole();
$table = new DifferentialHunkLegacy(); $table = new DifferentialLegacyHunk();
foreach (new LiskMigrationIterator($table) as $hunk) { foreach (new LiskMigrationIterator($table) as $hunk) {
$saw_any_rows = true; $saw_any_rows = true;
$id = $hunk->getID(); $id = $hunk->getID();
$console->writeOut("%s\n", pht('Migrating hunk %d...', $id)); $console->writeOut("%s\n", pht('Migrating hunk %d...', $id));
$new_hunk = id(new DifferentialHunkModern()) $new_hunk = id(new DifferentialModernHunk())
->setChangesetID($hunk->getChangesetID()) ->setChangesetID($hunk->getChangesetID())
->setOldOffset($hunk->getOldOffset()) ->setOldOffset($hunk->getOldOffset())
->setOldLen($hunk->getOldLen()) ->setOldLen($hunk->getOldLen())

View file

@ -3,7 +3,7 @@
final class DifferentialChangesetParserTestCase extends PhabricatorTestCase { final class DifferentialChangesetParserTestCase extends PhabricatorTestCase {
public function testDiffChangesets() { public function testDiffChangesets() {
$hunk = new DifferentialHunkModern(); $hunk = new DifferentialModernHunk();
$hunk->setChanges("+a\n b\n-c"); $hunk->setChanges("+a\n b\n-c");
$hunk->setNewOffset(1); $hunk->setNewOffset(1);
$hunk->setNewLen(2); $hunk->setNewLen(2);
@ -20,7 +20,7 @@ final class DifferentialChangesetParserTestCase extends PhabricatorTestCase {
); );
foreach ($tests as $changes => $expected) { foreach ($tests as $changes => $expected) {
$hunk = new DifferentialHunkModern(); $hunk = new DifferentialModernHunk();
$hunk->setChanges($changes); $hunk->setChanges($changes);
$hunk->setNewOffset(11); $hunk->setNewOffset(11);
$hunk->setNewLen(3); $hunk->setNewLen(3);

View file

@ -14,7 +14,7 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase {
$new_len, $new_len,
$changes) { $changes) {
$hunk = id(new DifferentialHunkModern()) $hunk = id(new DifferentialModernHunk())
->setOldOffset($old_offset) ->setOldOffset($old_offset)
->setOldLen($old_len) ->setOldLen($old_len)
->setNewOffset($new_offset) ->setNewOffset($new_offset)

View file

@ -34,7 +34,7 @@ final class DifferentialHunkQuery
$all_results = array(); $all_results = array();
// Load modern hunks. // Load modern hunks.
$table = new DifferentialHunkModern(); $table = new DifferentialModernHunk();
$conn_r = $table->establishConnection('r'); $conn_r = $table->establishConnection('r');
$modern_data = queryfx_all( $modern_data = queryfx_all(
@ -48,7 +48,7 @@ final class DifferentialHunkQuery
// Now, load legacy hunks. // Now, load legacy hunks.
$table = new DifferentialHunkLegacy(); $table = new DifferentialLegacyHunk();
$conn_r = $table->establishConnection('r'); $conn_r = $table->establishConnection('r');
$legacy_data = queryfx_all( $legacy_data = queryfx_all(

View file

@ -98,14 +98,14 @@ final class DifferentialChangeset extends DifferentialDAO
public function delete() { public function delete() {
$this->openTransaction(); $this->openTransaction();
$legacy_hunks = id(new DifferentialHunkLegacy())->loadAllWhere( $legacy_hunks = id(new DifferentialLegacyHunk())->loadAllWhere(
'changesetID = %d', 'changesetID = %d',
$this->getID()); $this->getID());
foreach ($legacy_hunks as $legacy_hunk) { foreach ($legacy_hunks as $legacy_hunk) {
$legacy_hunk->delete(); $legacy_hunk->delete();
} }
$modern_hunks = id(new DifferentialHunkModern())->loadAllWhere( $modern_hunks = id(new DifferentialModernHunk())->loadAllWhere(
'changesetID = %d', 'changesetID = %d',
$this->getID()); $this->getID());
foreach ($modern_hunks as $modern_hunk) { foreach ($modern_hunks as $modern_hunk) {

View file

@ -193,7 +193,7 @@ final class DifferentialDiff
$hunks = $change->getHunks(); $hunks = $change->getHunks();
if ($hunks) { if ($hunks) {
foreach ($hunks as $hunk) { foreach ($hunks as $hunk) {
$dhunk = new DifferentialHunkModern(); $dhunk = new DifferentialModernHunk();
$dhunk->setOldOffset($hunk->getOldOffset()); $dhunk->setOldOffset($hunk->getOldOffset());
$dhunk->setOldLen($hunk->getOldLength()); $dhunk->setOldLen($hunk->getOldLength());
$dhunk->setNewOffset($hunk->getNewOffset()); $dhunk->setNewOffset($hunk->getNewOffset());

View file

@ -1,6 +1,6 @@
<?php <?php
final class DifferentialHunkLegacy extends DifferentialHunk { final class DifferentialLegacyHunk extends DifferentialHunk {
protected $changes; protected $changes;

View file

@ -1,6 +1,6 @@
<?php <?php
final class DifferentialHunkModern extends DifferentialHunk { final class DifferentialModernHunk extends DifferentialHunk {
const DATATYPE_TEXT = 'text'; const DATATYPE_TEXT = 'text';
const DATATYPE_FILE = 'file'; const DATATYPE_FILE = 'file';

View file

@ -5,7 +5,7 @@ final class DifferentialHunkTestCase extends ArcanistPhutilTestCase {
public function testMakeChanges() { public function testMakeChanges() {
$root = dirname(__FILE__).'/hunk/'; $root = dirname(__FILE__).'/hunk/';
$hunk = new DifferentialHunkModern(); $hunk = new DifferentialModernHunk();
$hunk->setChanges(Filesystem::readFile($root.'basic.diff')); $hunk->setChanges(Filesystem::readFile($root.'basic.diff'));
$hunk->setOldOffset(1); $hunk->setOldOffset(1);
$hunk->setNewOffset(11); $hunk->setNewOffset(11);
@ -23,7 +23,7 @@ final class DifferentialHunkTestCase extends ArcanistPhutilTestCase {
); );
$this->assertEqual($added, $hunk->getAddedLines()); $this->assertEqual($added, $hunk->getAddedLines());
$hunk = new DifferentialHunkModern(); $hunk = new DifferentialModernHunk();
$hunk->setChanges(Filesystem::readFile($root.'newline.diff')); $hunk->setChanges(Filesystem::readFile($root.'newline.diff'));
$hunk->setOldOffset(1); $hunk->setOldOffset(1);
$hunk->setNewOffset(11); $hunk->setNewOffset(11);

View file

@ -402,8 +402,8 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
// -echo "test"; // -echo "test";
// -(empty line) // -(empty line)
$hunk = id(new DifferentialHunkModern())->setChanges($context); $hunk = id(new DifferentialModernHunk())->setChanges($context);
$vs_hunk = id(new DifferentialHunkModern())->setChanges($vs_context); $vs_hunk = id(new DifferentialModernHunk())->setChanges($vs_context);
if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() || if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() ||
$hunk->makeNewFile() != $vs_hunk->makeNewFile()) { $hunk->makeNewFile() != $vs_hunk->makeNewFile()) {
return $vs_diff; return $vs_diff;