From 021223907dfd267f6d4f08d2dfc01597afb8d341 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 19 May 2015 00:36:52 +1000 Subject: [PATCH] Remove arcanist projects from differential Summary: Ref T7604. Remove arcanist projects from differential. Depends on D12687 and D12893. Test Plan: Submitted a diff. Patched the diff with `arc patch`. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7604 Differential Revision: https://secure.phabricator.com/D12894 --- resources/celerity/map.php | 18 ++++---- src/__phutil_library_map__.php | 2 - ...DifferentialCreateDiffConduitAPIMethod.php | 19 +-------- .../DifferentialGetDiffConduitAPIMethod.php | 9 ++-- ...ifferentialGetRevisionConduitAPIMethod.php | 7 ++-- .../DifferentialQueryConduitAPIMethod.php | 16 ------- ...DifferentialQueryDiffsConduitAPIMethod.php | 1 - .../DifferentialRevisionViewController.php | 1 - .../DifferentialArcanistProjectField.php | 42 ------------------- .../editor/DifferentialDiffEditor.php | 3 +- .../editor/DifferentialTransactionEditor.php | 1 - .../query/DifferentialDiffQuery.php | 33 --------------- .../query/DifferentialRepositoryLookup.php | 16 ------- .../query/DifferentialRevisionQuery.php | 21 ---------- .../differential/storage/DifferentialDiff.php | 1 - ...torRepositoryCommitMessageParserWorker.php | 8 ---- 16 files changed, 19 insertions(+), 179 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialArcanistProjectField.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3aecd78dfc..5b985f4de7 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,7 +11,7 @@ return array( 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', - 'differential.pkg.js' => '895b8d62', + 'differential.pkg.js' => '45b3b51d', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => '0115b37c', 'maniphest.pkg.css' => '68d4dd3d', @@ -397,7 +397,7 @@ return array( 'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf', 'rsrc/js/application/releeph/releeph-request-state-change.js' => 'a0b57eb8', 'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'de2e896f', - 'rsrc/js/application/repository/repository-crossreference.js' => 'f9539603', + 'rsrc/js/application/repository/repository-crossreference.js' => '3975b470', 'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08', 'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f', 'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6', @@ -631,7 +631,7 @@ return array( 'javelin-behavior-remarkup-preview' => 'f7379f45', 'javelin-behavior-reorder-applications' => '76b9fc3e', 'javelin-behavior-reorder-columns' => 'e1d25dfb', - 'javelin-behavior-repository-crossreference' => 'f9539603', + 'javelin-behavior-repository-crossreference' => '3975b470', 'javelin-behavior-scrollbar' => '834a1173', 'javelin-behavior-search-reorder-queries' => 'e9581f08', 'javelin-behavior-select-on-click' => '4e3e79a6', @@ -1041,6 +1041,12 @@ return array( '331b1611' => array( 'javelin-install', ), + '3975b470' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-uri', + ), '3ab51e2c' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1986,12 +1992,6 @@ return array( 'javelin-util', 'phabricator-busy', ), - 'f9539603' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-uri', - ), 'fa0f4fc2' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index be579679c5..96d2502491 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -296,7 +296,6 @@ phutil_register_library_map(array( 'DifferentialAdjustmentMapTestCase' => 'applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php', 'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php', 'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php', - 'DifferentialArcanistProjectField' => 'applications/differential/customfield/DifferentialArcanistProjectField.php', 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php', 'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php', 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php', @@ -3542,7 +3541,6 @@ phutil_register_library_map(array( 'DifferentialAdjustmentMapTestCase' => 'ArcanistPhutilTestCase', 'DifferentialAffectedPath' => 'DifferentialDAO', 'DifferentialApplyPatchField' => 'DifferentialCustomField', - 'DifferentialArcanistProjectField' => 'DifferentialCustomField', 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', 'DifferentialAuthorField' => 'DifferentialCustomField', diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php index 6db5bc6cb4..8839eee6d7 100644 --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -12,7 +12,6 @@ final class DifferentialCreateDiffConduitAPIMethod } protected function defineParamTypes() { - $vcs_const = $this->formatStringConstants( array( 'svn', @@ -40,7 +39,7 @@ final class DifferentialCreateDiffConduitAPIMethod 'sourceControlPath' => 'required string', 'sourceControlBaseRevision' => 'required string', 'creationMethod' => 'optional string', - 'arcanistProject' => 'optional string', + 'arcanistProject' => 'deprecated', 'lintStatus' => 'required '.$status_const, 'unitStatus' => 'required '.$status_const, 'repositoryPHID' => 'optional phid', @@ -84,21 +83,6 @@ final class DifferentialCreateDiffConduitAPIMethod } } - $project_name = $request->getValue('arcanistProject'); - $project_phid = null; - if ($project_name) { - $arcanist_project = id(new PhabricatorRepositoryArcanistProject()) - ->loadOneWhere( - 'name = %s', - $project_name); - if (!$arcanist_project) { - $arcanist_project = new PhabricatorRepositoryArcanistProject(); - $arcanist_project->setName($project_name); - $arcanist_project->save(); - } - $project_phid = $arcanist_project->getPHID(); - } - switch ($request->getValue('lintStatus')) { case 'skip': $lint_status = DifferentialLintStatus::LINT_SKIP; @@ -156,7 +140,6 @@ final class DifferentialCreateDiffConduitAPIMethod 'sourceControlPath' => $request->getValue('sourceControlPath'), 'sourceControlBaseRevision' => $request->getValue('sourceControlBaseRevision'), - 'arcanistProjectPHID' => $project_phid, 'lintStatus' => $lint_status, 'unitStatus' => $unit_status, ); diff --git a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php index 4770821f78..92d9807dda 100644 --- a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php @@ -17,13 +17,15 @@ final class DifferentialGetDiffConduitAPIMethod public function getMethodStatusDescription() { return pht( - 'This method has been deprecated in favor of differential.querydiffs.'); + 'This method has been deprecated in favor of %s.', + 'differential.querydiffs'); } public function getMethodDescription() { - return pht('Load the content of a diff from Differential by revision id '. - 'or diff id.'); + return pht( + 'Load the content of a diff from Differential by revision id '. + 'or diff id.'); } protected function defineParamTypes() { @@ -67,7 +69,6 @@ final class DifferentialGetDiffConduitAPIMethod ->setViewer($request->getUser()) ->withIDs(array($diff_id)) ->needChangesets(true) - ->needArcanistProjects(true) ->executeOne(); } diff --git a/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php index db0aeae83f..a158d86d9f 100644 --- a/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php @@ -12,11 +12,11 @@ final class DifferentialGetRevisionConduitAPIMethod } public function getMethodStatusDescription() { - return "Replaced by 'differential.query'."; + return pht("Replaced by '%s'.", 'differential.query'); } public function getMethodDescription() { - return 'Load the content of a revision from Differential.'; + return pht('Load the content of a revision from Differential.'); } protected function defineParamTypes() { @@ -31,7 +31,7 @@ final class DifferentialGetRevisionConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_REVISION' => 'No such revision exists.', + 'ERR_BAD_REVISION' => pht('No such revision exists.'), ); } @@ -56,7 +56,6 @@ final class DifferentialGetRevisionConduitAPIMethod ->setViewer($request->getUser()) ->withRevisionIDs(array($revision_id)) ->needChangesets(true) - ->needArcanistProjects(true) ->execute(); $diff_dicts = mpull($diffs, 'getDiffDict'); diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php index 04af9ff234..305b071be8 100644 --- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php @@ -44,7 +44,6 @@ final class DifferentialQueryConduitAPIMethod 'subscribers' => 'optional list', 'responsibleUsers' => 'optional list', 'branches' => 'optional list', - 'arcanistProjects' => 'optional list', ); } @@ -73,7 +72,6 @@ final class DifferentialQueryConduitAPIMethod $subscribers = $request->getValue('subscribers'); $responsible_users = $request->getValue('responsibleUsers'); $branches = $request->getValue('branches'); - $arc_projects = $request->getValue('arcanistProjects'); $query = id(new DifferentialRevisionQuery()) ->setViewer($request->getUser()); @@ -169,19 +167,6 @@ final class DifferentialQueryConduitAPIMethod if ($branches) { $query->withBranches($branches); } - if ($arc_projects) { - // This is sort of special-cased, but don't make arc do an extra round - // trip. - $projects = id(new PhabricatorRepositoryArcanistProject()) - ->loadAllWhere( - 'name in (%Ls)', - $arc_projects); - if (!$projects) { - return array(); - } - - $query->withArcanistProjectPHIDs(mpull($projects, 'getPHID')); - } $query->needRelationships(true); $query->needCommitPHIDs(true); @@ -228,7 +213,6 @@ final class DifferentialQueryConduitAPIMethod 'ccs' => array_values($revision->getCCPHIDs()), 'hashes' => $revision->getHashes(), 'auxiliary' => idx($field_data, $phid, array()), - 'arcanistProjectPHID' => $diff->getArcanistProjectPHID(), 'repositoryPHID' => $diff->getRepositoryPHID(), ); diff --git a/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php index 630f07da2b..836181d1df 100644 --- a/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php @@ -33,7 +33,6 @@ final class DifferentialQueryDiffsConduitAPIMethod ->withIDs($ids) ->withRevisionIDs($revision_ids) ->needChangesets(true) - ->needArcanistProjects(true) ->execute(); } diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index d1b021b8d0..849ef056aa 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -33,7 +33,6 @@ final class DifferentialRevisionViewController extends DifferentialController { $diffs = id(new DifferentialDiffQuery()) ->setViewer($request->getUser()) ->withRevisionIDs(array($this->revisionID)) - ->needArcanistProjects(true) ->execute(); $diffs = array_reverse($diffs, $preserve_keys = true); diff --git a/src/applications/differential/customfield/DifferentialArcanistProjectField.php b/src/applications/differential/customfield/DifferentialArcanistProjectField.php deleted file mode 100644 index f884e701a6..0000000000 --- a/src/applications/differential/customfield/DifferentialArcanistProjectField.php +++ /dev/null @@ -1,42 +0,0 @@ -getFieldName(); - } - - public function getRequiredHandlePHIDsForPropertyView() { - $phid = $this->getArcanistProjectPHID(); - if ($phid) { - return array($phid); - } - return array(); - } - - public function renderPropertyViewValue(array $handles) { - return $this->renderHandleList($handles); - } - - private function getArcanistProjectPHID() { - return $this->getObject()->getActiveDiff()->getArcanistProjectPHID(); - } - -} diff --git a/src/applications/differential/editor/DifferentialDiffEditor.php b/src/applications/differential/editor/DifferentialDiffEditor.php index 9d4fa0767c..25385899b1 100644 --- a/src/applications/differential/editor/DifferentialDiffEditor.php +++ b/src/applications/differential/editor/DifferentialDiffEditor.php @@ -234,8 +234,7 @@ final class DifferentialDiffEditor ->setSourceControlPath(idx($dict, 'sourceControlPath')) ->setSourceControlBaseRevision(idx($dict, 'sourceControlBaseRevision')) ->setLintStatus(idx($dict, 'lintStatus')) - ->setUnitStatus(idx($dict, 'unitStatus')) - ->setArcanistProjectPHID(idx($dict, 'arcanistProjectPHID')); + ->setUnitStatus(idx($dict, 'unitStatus')); return $diff; } diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 113d6924f3..94889213ba 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -220,7 +220,6 @@ final class DifferentialTransactionEditor } else { $object->setRepositoryPHID($diff->getRepositoryPHID()); } - $object->setArcanistProjectPHID($diff->getArcanistProjectPHID()); $object->attachActiveDiff($diff); // TODO: Update the `diffPHID` once we add that. diff --git a/src/applications/differential/query/DifferentialDiffQuery.php b/src/applications/differential/query/DifferentialDiffQuery.php index 15ddc9c46b..1616d58ac8 100644 --- a/src/applications/differential/query/DifferentialDiffQuery.php +++ b/src/applications/differential/query/DifferentialDiffQuery.php @@ -7,7 +7,6 @@ final class DifferentialDiffQuery private $phids; private $revisionIDs; private $needChangesets = false; - private $needArcanistProjects = false; public function withIDs(array $ids) { $this->ids = $ids; @@ -29,11 +28,6 @@ final class DifferentialDiffQuery return $this; } - public function needArcanistProjects($bool) { - $this->needArcanistProjects = $bool; - return $this; - } - protected function loadPage() { $table = new DifferentialDiff(); $conn_r = $table->establishConnection('r'); @@ -79,10 +73,6 @@ final class DifferentialDiffQuery $diffs = $this->loadChangesets($diffs); } - if ($diffs && $this->needArcanistProjects) { - $diffs = $this->loadArcanistProjects($diffs); - } - return $diffs; } @@ -98,29 +88,6 @@ final class DifferentialDiffQuery return $diffs; } - private function loadArcanistProjects(array $diffs) { - $phids = array_filter(mpull($diffs, 'getArcanistProjectPHID')); - $projects = array(); - $project_map = array(); - if ($phids) { - $projects = id(new PhabricatorRepositoryArcanistProject()) - ->loadAllWhere( - 'phid IN (%Ls)', - $phids); - $project_map = mpull($projects, null, 'getPHID'); - } - - foreach ($diffs as $diff) { - $project = null; - if ($diff->getArcanistProjectPHID()) { - $project = idx($project_map, $diff->getArcanistProjectPHID()); - } - $diff->attachArcanistProject($project); - } - - return $diffs; - } - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { $where = array(); diff --git a/src/applications/differential/query/DifferentialRepositoryLookup.php b/src/applications/differential/query/DifferentialRepositoryLookup.php index c964bf4580..4a498edb55 100644 --- a/src/applications/differential/query/DifferentialRepositoryLookup.php +++ b/src/applications/differential/query/DifferentialRepositoryLookup.php @@ -22,22 +22,6 @@ final class DifferentialRepositoryLookup extends Phobject { $viewer = $this->viewer; $diff = $this->diff; - // Look for an explicit Arcanist project. - if ($diff->getArcanistProjectPHID()) { - $project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere( - 'phid = %s', - $diff->getArcanistProjectPHID()); - if ($project && $project->getRepositoryID()) { - $repositories = id(new PhabricatorRepositoryQuery()) - ->setViewer($viewer) - ->withIDs(array($project->getRepositoryID())) - ->execute(); - if ($repositories) { - return head($repositories); - } - } - } - // Look for a repository UUID. if ($diff->getRepositoryUUID()) { $repositories = id(new PhabricatorRepositoryQuery()) diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php index 2ac7289853..d49ef34887 100644 --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -36,7 +36,6 @@ final class DifferentialRevisionQuery private $phids = array(); private $responsibles = array(); private $branches = array(); - private $arcanistProjectPHIDs = array(); private $repositoryPHIDs; private $updatedEpochMin; private $updatedEpochMax; @@ -228,19 +227,6 @@ final class DifferentialRevisionQuery } - /** - * Filter results to only return revisions with a given set of arcanist - * projects. - * - * @param array List of project PHIDs. - * @return this - * @task config - */ - public function withArcanistProjectPHIDs(array $arc_project_phids) { - $this->arcanistProjectPHIDs = $arc_project_phids; - return $this; - } - public function withRepositoryPHIDs(array $repository_phids) { $this->repositoryPHIDs = $repository_phids; return $this; @@ -771,13 +757,6 @@ final class DifferentialRevisionQuery $this->branches); } - if ($this->arcanistProjectPHIDs) { - $where[] = qsprintf( - $conn_r, - 'r.arcanistProjectPHID in (%Ls)', - $this->arcanistProjectPHIDs); - } - if ($this->updatedEpochMin !== null) { $where[] = qsprintf( $conn_r, diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index 9092f365bc..6c67cff51e 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -262,7 +262,6 @@ final class DifferentialDiff 'lintStatus' => $this->getLintStatus(), 'changes' => array(), 'properties' => array(), - 'projectName' => $this->getArcanistProjectName(), ); $dict['changes'] = $this->buildChangesList(); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 25272ca940..89fa5f34f4 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -321,14 +321,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker $this->repository->getCallsign(). $this->commit->getCommitIdentifier()); - // TODO: This is not correct in SVN where one repository can have multiple - // Arcanist projects. - $arcanist_project = id(new PhabricatorRepositoryArcanistProject()) - ->loadOneWhere('repositoryID = %d LIMIT 1', $this->repository->getID()); - if ($arcanist_project) { - $diff->setArcanistProjectPHID($arcanist_project->getPHID()); - } - $parents = DiffusionQuery::callConduitWithDiffusionRequest( $viewer, $drequest,