From 3c64cb4d0a7a9c969db63f88cfa7716f4cda8b67 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 5 Jan 2015 06:33:42 +1100 Subject: [PATCH] Rename `DifferentialLandingStrategy` subclasses for consistency Summary: Ref T5655. Test Plan: `grep` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: avivey, Korvin, epriestley Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D11186 --- src/__phutil_library_map__.php | 12 +++++----- ... => DifferentialGitHubLandingStrategy.php} | 19 +++++----------- ... DifferentialHostedGitLandingStrategy.php} | 22 +++++-------------- ...rentialHostedMercurialLandingStrategy.php} | 20 +++++------------ .../landing/DifferentialLandingStrategy.php | 2 +- 5 files changed, 23 insertions(+), 52 deletions(-) rename src/applications/differential/landing/{DifferentialLandingToGitHub.php => DifferentialGitHubLandingStrategy.php} (91%) rename src/applications/differential/landing/{DifferentialLandingToHostedGit.php => DifferentialHostedGitLandingStrategy.php} (87%) rename src/applications/differential/landing/{DifferentialLandingToHostedMercurial.php => DifferentialHostedMercurialLandingStrategy.php} (83%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c02d28f70f..7af54c9a8d 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -355,8 +355,11 @@ phutil_register_library_map(array( 'DifferentialGetRevisionCommentsConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php', 'DifferentialGetRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php', 'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php', + 'DifferentialGitHubLandingStrategy' => 'applications/differential/landing/DifferentialGitHubLandingStrategy.php', 'DifferentialGitSVNIDField' => 'applications/differential/customfield/DifferentialGitSVNIDField.php', 'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php', + 'DifferentialHostedGitLandingStrategy' => 'applications/differential/landing/DifferentialHostedGitLandingStrategy.php', + 'DifferentialHostedMercurialLandingStrategy' => 'applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php', 'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php', 'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.php', 'DifferentialHunkLegacy' => 'applications/differential/storage/DifferentialHunkLegacy.php', @@ -374,9 +377,6 @@ phutil_register_library_map(array( 'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php', 'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php', 'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php', - 'DifferentialLandingToGitHub' => 'applications/differential/landing/DifferentialLandingToGitHub.php', - 'DifferentialLandingToHostedGit' => 'applications/differential/landing/DifferentialLandingToHostedGit.php', - 'DifferentialLandingToHostedMercurial' => 'applications/differential/landing/DifferentialLandingToHostedMercurial.php', 'DifferentialLintField' => 'applications/differential/customfield/DifferentialLintField.php', 'DifferentialLintStatus' => 'applications/differential/constants/DifferentialLintStatus.php', 'DifferentialLocalCommitsView' => 'applications/differential/view/DifferentialLocalCommitsView.php', @@ -3414,8 +3414,11 @@ phutil_register_library_map(array( 'DifferentialGetRawDiffConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialGetRevisionCommentsConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialGetRevisionConduitAPIMethod' => 'DifferentialConduitAPIMethod', + 'DifferentialGitHubLandingStrategy' => 'DifferentialLandingStrategy', 'DifferentialGitSVNIDField' => 'DifferentialCustomField', 'DifferentialHostField' => 'DifferentialCustomField', + 'DifferentialHostedGitLandingStrategy' => 'DifferentialLandingStrategy', + 'DifferentialHostedMercurialLandingStrategy' => 'DifferentialLandingStrategy', 'DifferentialHovercardEventListener' => 'PhabricatorEventListener', 'DifferentialHunk' => array( 'DifferentialDAO', @@ -3434,9 +3437,6 @@ phutil_register_library_map(array( 'DifferentialInlineCommentView' => 'AphrontView', 'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField', 'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener', - 'DifferentialLandingToGitHub' => 'DifferentialLandingStrategy', - 'DifferentialLandingToHostedGit' => 'DifferentialLandingStrategy', - 'DifferentialLandingToHostedMercurial' => 'DifferentialLandingStrategy', 'DifferentialLintField' => 'DifferentialCustomField', 'DifferentialLocalCommitsView' => 'AphrontView', 'DifferentialMail' => 'PhabricatorMail', diff --git a/src/applications/differential/landing/DifferentialLandingToGitHub.php b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php similarity index 91% rename from src/applications/differential/landing/DifferentialLandingToGitHub.php rename to src/applications/differential/landing/DifferentialGitHubLandingStrategy.php index 81f98c2483..7160743bb9 100644 --- a/src/applications/differential/landing/DifferentialLandingToGitHub.php +++ b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php @@ -1,6 +1,6 @@ getGitWorkspace($repository); try { - id(new DifferentialLandingToHostedGit()) - ->commitRevisionToWorkspace( - $revision, - $workspace, - $viewer); + id(new DifferentialHostedGitLandingStrategy()) + ->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException( - 'Failed to commit patch', - $e); + throw new PhutilProxyException('Failed to commit patch', $e); } try { @@ -38,14 +33,12 @@ final class DifferentialLandingToGitHub } // Else, throw what git said. - throw new PhutilProxyException( - 'Failed to push changes upstream', - $e); + throw new PhutilProxyException('Failed to push changes upstream', $e); } } /** - * returns PhabricatorActionView or an array of PhabricatorActionView or null. + * Returns PhabricatorActionView or an array of PhabricatorActionView or null. */ public function createMenuItem( PhabricatorUser $viewer, diff --git a/src/applications/differential/landing/DifferentialLandingToHostedGit.php b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php similarity index 87% rename from src/applications/differential/landing/DifferentialLandingToHostedGit.php rename to src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php index 2cf3350341..68f0980db1 100644 --- a/src/applications/differential/landing/DifferentialLandingToHostedGit.php +++ b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php @@ -1,6 +1,6 @@ getUser(); - $workspace = $this->getGitWorkspace($repository); try { - $this->commitRevisionToWorkspace( - $revision, - $workspace, - $viewer); + $this->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException( - 'Failed to commit patch', - $e); + throw new PhutilProxyException('Failed to commit patch', $e); } try { - $this->pushWorkspaceRepository( - $repository, - $workspace, - $viewer); + $this->pushWorkspaceRepository($repository, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException( - 'Failed to push changes upstream', - $e); + throw new PhutilProxyException('Failed to push changes upstream', $e); } } @@ -96,7 +85,6 @@ final class DifferentialLandingToHostedGit $message); } - public function pushWorkspaceRepository( PhabricatorRepository $repository, ArcanistRepositoryAPI $workspace, diff --git a/src/applications/differential/landing/DifferentialLandingToHostedMercurial.php b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php similarity index 83% rename from src/applications/differential/landing/DifferentialLandingToHostedMercurial.php rename to src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php index e121b22441..0303be62af 100644 --- a/src/applications/differential/landing/DifferentialLandingToHostedMercurial.php +++ b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php @@ -1,6 +1,6 @@ getMercurialWorkspace($repository); try { - $this->commitRevisionToWorkspace( - $revision, - $workspace, - $viewer); + $this->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException( - 'Failed to commit patch', - $e); + throw new PhutilProxyException('Failed to commit patch', $e); } try { - $this->pushWorkspaceRepository( - $repository, - $workspace, - $viewer); + $this->pushWorkspaceRepository($repository, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException( - 'Failed to push changes upstream', - $e); + throw new PhutilProxyException('Failed to push changes upstream', $e); } } diff --git a/src/applications/differential/landing/DifferentialLandingStrategy.php b/src/applications/differential/landing/DifferentialLandingStrategy.php index 92fcaf34bf..96d948f608 100644 --- a/src/applications/differential/landing/DifferentialLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialLandingStrategy.php @@ -62,7 +62,7 @@ abstract class DifferentialLandingStrategy { */ protected function getGitWorkspace(PhabricatorRepository $repository) { try { - return DifferentialGetWorkingCopy::getCleanGitWorkspace($repository); + return DifferentialGetWorkingCopy::getCleanGitWorkspace($repository); } catch (Exception $e) { throw new PhutilProxyException('Failed to allocate a workspace', $e); }