1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Remove almost all old Differential field code

Summary: Ref T2222. The unit and lint fields still have one piece of functionality that I need to port, but everythign else is obsolete.

Test Plan: Lots of `grep`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2222

Differential Revision: https://secure.phabricator.com/D8474
This commit is contained in:
epriestley 2014-03-09 12:55:57 -07:00
parent 3f67430f46
commit 20cc85878e
45 changed files with 30 additions and 3541 deletions

View file

@ -321,21 +321,12 @@ phutil_register_library_map(array(
'DifferentialAddCommentView' => 'applications/differential/view/DifferentialAddCommentView.php',
'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php',
'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php',
'DifferentialApplyPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php',
'DifferentialArcanistProjectField' => 'applications/differential/customfield/DifferentialArcanistProjectField.php',
'DifferentialArcanistProjectFieldSpecification' => 'applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php',
'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php',
'DifferentialAsanaRepresentationFieldSpecification' => 'applications/differential/field/specification/DifferentialAsanaRepresentationFieldSpecification.php',
'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php',
'DifferentialAuditorsFieldSpecification' => 'applications/differential/field/specification/DifferentialAuditorsFieldSpecification.php',
'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php',
'DifferentialAuthorFieldSpecification' => 'applications/differential/field/specification/DifferentialAuthorFieldSpecification.php',
'DifferentialAuxiliaryField' => 'applications/differential/storage/DifferentialAuxiliaryField.php',
'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php',
'DifferentialBlameRevisionFieldSpecification' => 'applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php',
'DifferentialBranchField' => 'applications/differential/customfield/DifferentialBranchField.php',
'DifferentialBranchFieldSpecification' => 'applications/differential/field/specification/DifferentialBranchFieldSpecification.php',
'DifferentialCCsFieldSpecification' => 'applications/differential/field/specification/DifferentialCCsFieldSpecification.php',
'DifferentialCapabilityDefaultView' => 'applications/differential/capability/DifferentialCapabilityDefaultView.php',
'DifferentialChangeType' => 'applications/differential/constants/DifferentialChangeType.php',
'DifferentialChangeset' => 'applications/differential/storage/DifferentialChangeset.php',
@ -359,9 +350,7 @@ phutil_register_library_map(array(
'DifferentialCommitMessageParser' => 'applications/differential/parser/DifferentialCommitMessageParser.php',
'DifferentialCommitMessageParserTestCase' => 'applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php',
'DifferentialCommitsField' => 'applications/differential/customfield/DifferentialCommitsField.php',
'DifferentialCommitsFieldSpecification' => 'applications/differential/field/specification/DifferentialCommitsFieldSpecification.php',
'DifferentialConflictsField' => 'applications/differential/customfield/DifferentialConflictsField.php',
'DifferentialConflictsFieldSpecification' => 'applications/differential/field/specification/DifferentialConflictsFieldSpecification.php',
'DifferentialController' => 'applications/differential/controller/DifferentialController.php',
'DifferentialCoreCustomField' => 'applications/differential/customfield/DifferentialCoreCustomField.php',
'DifferentialCustomField' => 'applications/differential/customfield/DifferentialCustomField.php',
@ -373,12 +362,8 @@ phutil_register_library_map(array(
'DifferentialCustomFieldStorage' => 'applications/differential/storage/DifferentialCustomFieldStorage.php',
'DifferentialCustomFieldStringIndex' => 'applications/differential/storage/DifferentialCustomFieldStringIndex.php',
'DifferentialDAO' => 'applications/differential/storage/DifferentialDAO.php',
'DifferentialDateCreatedFieldSpecification' => 'applications/differential/field/specification/DifferentialDateCreatedFieldSpecification.php',
'DifferentialDateModifiedFieldSpecification' => 'applications/differential/field/specification/DifferentialDateModifiedFieldSpecification.php',
'DifferentialDependenciesField' => 'applications/differential/customfield/DifferentialDependenciesField.php',
'DifferentialDependenciesFieldSpecification' => 'applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php',
'DifferentialDependsOnField' => 'applications/differential/customfield/DifferentialDependsOnField.php',
'DifferentialDependsOnFieldSpecification' => 'applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php',
'DifferentialDiff' => 'applications/differential/storage/DifferentialDiff.php',
'DifferentialDiffCreateController' => 'applications/differential/controller/DifferentialDiffCreateController.php',
'DifferentialDiffProperty' => 'applications/differential/storage/DifferentialDiffProperty.php',
@ -386,25 +371,16 @@ phutil_register_library_map(array(
'DifferentialDiffTableOfContentsView' => 'applications/differential/view/DifferentialDiffTableOfContentsView.php',
'DifferentialDiffTestCase' => 'applications/differential/storage/__tests__/DifferentialDiffTestCase.php',
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
'DifferentialDiffViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialDiffViewPolicyFieldSpecification.php',
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php',
'DifferentialDraft' => 'applications/differential/storage/DifferentialDraft.php',
'DifferentialEditPolicyField' => 'applications/differential/customfield/DifferentialEditPolicyField.php',
'DifferentialEditPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialEditPolicyFieldSpecification.php',
'DifferentialException' => 'applications/differential/exception/DifferentialException.php',
'DifferentialExceptionMail' => 'applications/differential/mail/DifferentialExceptionMail.php',
'DifferentialExportPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php',
'DifferentialFieldDataNotAvailableException' => 'applications/differential/field/exception/DifferentialFieldDataNotAvailableException.php',
'DifferentialFieldParseException' => 'applications/differential/field/exception/DifferentialFieldParseException.php',
'DifferentialFieldSpecification' => 'applications/differential/field/specification/DifferentialFieldSpecification.php',
'DifferentialFieldSpecificationIncompleteException' => 'applications/differential/field/exception/DifferentialFieldSpecificationIncompleteException.php',
'DifferentialFieldValidationException' => 'applications/differential/field/exception/DifferentialFieldValidationException.php',
'DifferentialFreeformFieldSpecification' => 'applications/differential/field/specification/DifferentialFreeformFieldSpecification.php',
'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php',
'DifferentialGitSVNIDField' => 'applications/differential/customfield/DifferentialGitSVNIDField.php',
'DifferentialGitSVNIDFieldSpecification' => 'applications/differential/field/specification/DifferentialGitSVNIDFieldSpecification.php',
'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php',
'DifferentialHostFieldSpecification' => 'applications/differential/field/specification/DifferentialHostFieldSpecification.php',
'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php',
'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.php',
'DifferentialHunkParser' => 'applications/differential/parser/DifferentialHunkParser.php',
@ -417,13 +393,11 @@ phutil_register_library_map(array(
'DifferentialInlineCommentQuery' => 'applications/differential/query/DifferentialInlineCommentQuery.php',
'DifferentialInlineCommentView' => 'applications/differential/view/DifferentialInlineCommentView.php',
'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php',
'DifferentialJIRAIssuesFieldSpecification' => 'applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.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',
'DifferentialLinesFieldSpecification' => 'applications/differential/field/specification/DifferentialLinesFieldSpecification.php',
'DifferentialLintField' => 'applications/differential/customfield/DifferentialLintField.php',
'DifferentialLintFieldSpecification' => 'applications/differential/field/specification/DifferentialLintFieldSpecification.php',
'DifferentialLintStatus' => 'applications/differential/constants/DifferentialLintStatus.php',
@ -431,40 +405,31 @@ phutil_register_library_map(array(
'DifferentialMail' => 'applications/differential/mail/DifferentialMail.php',
'DifferentialMailPhase' => 'applications/differential/constants/DifferentialMailPhase.php',
'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php',
'DifferentialManiphestTasksFieldSpecification' => 'applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php',
'DifferentialPHIDTypeDiff' => 'applications/differential/phid/DifferentialPHIDTypeDiff.php',
'DifferentialPHIDTypeRevision' => 'applications/differential/phid/DifferentialPHIDTypeRevision.php',
'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php',
'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php',
'DifferentialPathField' => 'applications/differential/customfield/DifferentialPathField.php',
'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/DifferentialPathFieldSpecification.php',
'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php',
'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php',
'DifferentialProjectReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialProjectReviewersFieldSpecification.php',
'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php',
'DifferentialReleephRequestFieldSpecification' => 'applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php',
'DifferentialRemarkupRule' => 'applications/differential/remarkup/DifferentialRemarkupRule.php',
'DifferentialReplyHandler' => 'applications/differential/mail/DifferentialReplyHandler.php',
'DifferentialRepositoryField' => 'applications/differential/customfield/DifferentialRepositoryField.php',
'DifferentialRepositoryFieldSpecification' => 'applications/differential/field/specification/DifferentialRepositoryFieldSpecification.php',
'DifferentialRepositoryLookup' => 'applications/differential/query/DifferentialRepositoryLookup.php',
'DifferentialResultsTableView' => 'applications/differential/view/DifferentialResultsTableView.php',
'DifferentialRevertPlanField' => 'applications/differential/customfield/DifferentialRevertPlanField.php',
'DifferentialRevertPlanFieldSpecification' => 'applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php',
'DifferentialReviewedByField' => 'applications/differential/customfield/DifferentialReviewedByField.php',
'DifferentialReviewedByFieldSpecification' => 'applications/differential/field/specification/DifferentialReviewedByFieldSpecification.php',
'DifferentialReviewer' => 'applications/differential/storage/DifferentialReviewer.php',
'DifferentialReviewerStatus' => 'applications/differential/constants/DifferentialReviewerStatus.php',
'DifferentialReviewersField' => 'applications/differential/customfield/DifferentialReviewersField.php',
'DifferentialReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialReviewersFieldSpecification.php',
'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php',
'DifferentialRevision' => 'applications/differential/storage/DifferentialRevision.php',
'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php',
'DifferentialRevisionDetailView' => 'applications/differential/view/DifferentialRevisionDetailView.php',
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php',
'DifferentialRevisionIDFieldParserTestCase' => 'applications/differential/field/specification/__tests__/DifferentialRevisionIDFieldParserTestCase.php',
'DifferentialRevisionIDFieldSpecification' => 'applications/differential/field/specification/DifferentialRevisionIDFieldSpecification.php',
'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php',
'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php',
'DifferentialRevisionListView' => 'applications/differential/view/DifferentialRevisionListView.php',
@ -472,19 +437,15 @@ phutil_register_library_map(array(
'DifferentialRevisionQuery' => 'applications/differential/query/DifferentialRevisionQuery.php',
'DifferentialRevisionSearchEngine' => 'applications/differential/query/DifferentialRevisionSearchEngine.php',
'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php',
'DifferentialRevisionStatusFieldSpecification' => 'applications/differential/field/specification/DifferentialRevisionStatusFieldSpecification.php',
'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/DifferentialRevisionUpdateHistoryView.php',
'DifferentialRevisionViewController' => 'applications/differential/controller/DifferentialRevisionViewController.php',
'DifferentialSearchIndexer' => 'applications/differential/search/DifferentialSearchIndexer.php',
'DifferentialStoredCustomField' => 'applications/differential/customfield/DifferentialStoredCustomField.php',
'DifferentialSubscribersField' => 'applications/differential/customfield/DifferentialSubscribersField.php',
'DifferentialSummaryField' => 'applications/differential/customfield/DifferentialSummaryField.php',
'DifferentialSummaryFieldSpecification' => 'applications/differential/field/specification/DifferentialSummaryFieldSpecification.php',
'DifferentialTasksAttacher' => 'applications/differential/DifferentialTasksAttacher.php',
'DifferentialTestPlanField' => 'applications/differential/customfield/DifferentialTestPlanField.php',
'DifferentialTestPlanFieldSpecification' => 'applications/differential/field/specification/DifferentialTestPlanFieldSpecification.php',
'DifferentialTitleField' => 'applications/differential/customfield/DifferentialTitleField.php',
'DifferentialTitleFieldSpecification' => 'applications/differential/field/specification/DifferentialTitleFieldSpecification.php',
'DifferentialTransaction' => 'applications/differential/storage/DifferentialTransaction.php',
'DifferentialTransactionComment' => 'applications/differential/storage/DifferentialTransactionComment.php',
'DifferentialTransactionEditor' => 'applications/differential/editor/DifferentialTransactionEditor.php',
@ -495,7 +456,6 @@ phutil_register_library_map(array(
'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php',
'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php',
'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php',
'DifferentialViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialViewPolicyFieldSpecification.php',
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php',
'DiffusionBrowseController' => 'applications/diffusion/controller/DiffusionBrowseController.php',
@ -2891,20 +2851,12 @@ phutil_register_library_map(array(
'DifferentialAddCommentView' => 'AphrontView',
'DifferentialAffectedPath' => 'DifferentialDAO',
'DifferentialApplyPatchField' => 'DifferentialCustomField',
'DifferentialApplyPatchFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialArcanistProjectField' => 'DifferentialCustomField',
'DifferentialArcanistProjectFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialAsanaRepresentationField' => 'DifferentialCustomField',
'DifferentialAsanaRepresentationFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialAuditorsField' => 'DifferentialStoredCustomField',
'DifferentialAuditorsFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialAuthorField' => 'DifferentialCustomField',
'DifferentialAuthorFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField',
'DifferentialBlameRevisionFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialBranchField' => 'DifferentialCustomField',
'DifferentialBranchFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialCCsFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialCapabilityDefaultView' => 'PhabricatorPolicyCapability',
'DifferentialChangeset' => 'DifferentialDAO',
'DifferentialChangesetDetailView' => 'AphrontView',
@ -2923,9 +2875,7 @@ phutil_register_library_map(array(
'DifferentialCommentSaveController' => 'DifferentialController',
'DifferentialCommitMessageParserTestCase' => 'PhabricatorTestCase',
'DifferentialCommitsField' => 'DifferentialCustomField',
'DifferentialCommitsFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialConflictsField' => 'DifferentialCustomField',
'DifferentialConflictsFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialController' => 'PhabricatorController',
'DifferentialCoreCustomField' => 'DifferentialCustomField',
'DifferentialCustomField' => 'PhabricatorCustomField',
@ -2937,12 +2887,8 @@ phutil_register_library_map(array(
'DifferentialCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'DifferentialCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'DifferentialDAO' => 'PhabricatorLiskDAO',
'DifferentialDateCreatedFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDateModifiedFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDependenciesField' => 'DifferentialCustomField',
'DifferentialDependenciesFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDependsOnField' => 'DifferentialCustomField',
'DifferentialDependsOnFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDiff' =>
array(
0 => 'DifferentialDAO',
@ -2955,23 +2901,15 @@ phutil_register_library_map(array(
'DifferentialDiffTableOfContentsView' => 'AphrontView',
'DifferentialDiffTestCase' => 'ArcanistPhutilTestCase',
'DifferentialDiffViewController' => 'DifferentialController',
'DifferentialDiffViewPolicyFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher',
'DifferentialDraft' => 'DifferentialDAO',
'DifferentialEditPolicyField' => 'DifferentialCoreCustomField',
'DifferentialEditPolicyFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialException' => 'Exception',
'DifferentialExceptionMail' => 'DifferentialMail',
'DifferentialExportPatchFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialFieldDataNotAvailableException' => 'Exception',
'DifferentialFieldParseException' => 'Exception',
'DifferentialFieldSpecificationIncompleteException' => 'Exception',
'DifferentialFieldValidationException' => 'Exception',
'DifferentialFreeformFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialGitSVNIDField' => 'DifferentialCustomField',
'DifferentialGitSVNIDFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialHostField' => 'DifferentialCustomField',
'DifferentialHostFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialHovercardEventListener' => 'PhabricatorEventListener',
'DifferentialHunk' => 'DifferentialDAO',
'DifferentialHunkParserTestCase' => 'PhabricatorTestCase',
@ -2983,40 +2921,29 @@ phutil_register_library_map(array(
'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery',
'DifferentialInlineCommentView' => 'AphrontView',
'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField',
'DifferentialJIRAIssuesFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener',
'DifferentialLandingToGitHub' => 'DifferentialLandingStrategy',
'DifferentialLandingToHostedGit' => 'DifferentialLandingStrategy',
'DifferentialLandingToHostedMercurial' => 'DifferentialLandingStrategy',
'DifferentialLinesFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialLintField' => 'DifferentialCustomField',
'DifferentialLintFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialLocalCommitsView' => 'AphrontView',
'DifferentialMail' => 'PhabricatorMail',
'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField',
'DifferentialManiphestTasksFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialPHIDTypeDiff' => 'PhabricatorPHIDType',
'DifferentialPHIDTypeRevision' => 'PhabricatorPHIDType',
'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector',
'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',
'DifferentialPathField' => 'DifferentialCustomField',
'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialPrimaryPaneView' => 'AphrontView',
'DifferentialProjectReviewersField' => 'DifferentialCustomField',
'DifferentialProjectReviewersFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialReleephRequestFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialRemarkupRule' => 'PhabricatorRemarkupRuleObject',
'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler',
'DifferentialRepositoryField' => 'DifferentialCoreCustomField',
'DifferentialRepositoryFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialRepositoryLookup' => 'Phobject',
'DifferentialResultsTableView' => 'AphrontView',
'DifferentialRevertPlanField' => 'DifferentialStoredCustomField',
'DifferentialRevertPlanFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialReviewedByField' => 'DifferentialCoreCustomField',
'DifferentialReviewedByFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialReviewersField' => 'DifferentialCoreCustomField',
'DifferentialReviewersFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialReviewersView' => 'AphrontView',
'DifferentialRevision' =>
array(
@ -3032,8 +2959,6 @@ phutil_register_library_map(array(
'DifferentialRevisionDetailView' => 'AphrontView',
'DifferentialRevisionEditController' => 'DifferentialController',
'DifferentialRevisionIDField' => 'DifferentialCustomField',
'DifferentialRevisionIDFieldParserTestCase' => 'PhabricatorTestCase',
'DifferentialRevisionIDFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialRevisionLandController' => 'DifferentialController',
'DifferentialRevisionListController' =>
array(
@ -3044,27 +2969,21 @@ phutil_register_library_map(array(
'DifferentialRevisionMailReceiver' => 'PhabricatorObjectMailReceiver',
'DifferentialRevisionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DifferentialRevisionSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DifferentialRevisionStatusFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialRevisionUpdateHistoryView' => 'AphrontView',
'DifferentialRevisionViewController' => 'DifferentialController',
'DifferentialSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'DifferentialStoredCustomField' => 'DifferentialCustomField',
'DifferentialSubscribersField' => 'DifferentialCoreCustomField',
'DifferentialSummaryField' => 'DifferentialCoreCustomField',
'DifferentialSummaryFieldSpecification' => 'DifferentialFreeformFieldSpecification',
'DifferentialTestPlanField' => 'DifferentialCoreCustomField',
'DifferentialTestPlanFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialTitleField' => 'DifferentialCoreCustomField',
'DifferentialTitleFieldSpecification' => 'DifferentialFreeformFieldSpecification',
'DifferentialTransaction' => 'PhabricatorApplicationTransaction',
'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment',
'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'DifferentialTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'DifferentialTransactionView' => 'PhabricatorApplicationTransactionView',
'DifferentialUnitField' => 'DifferentialCustomField',
'DifferentialUnitFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialViewPolicyField' => 'DifferentialCoreCustomField',
'DifferentialViewPolicyFieldSpecification' => 'DifferentialFieldSpecification',
'DiffusionBranchTableController' => 'DiffusionController',
'DiffusionBranchTableView' => 'DiffusionView',
'DiffusionBrowseController' => 'DiffusionController',

View file

@ -34,12 +34,35 @@ final class DifferentialRevisionIDField
}
public function parseValueFromCommitMessage($value) {
return DifferentialRevisionIDFieldSpecification::parseRevisionIDFromURI(
$value);
return self::parseRevisionIDFromURI($value);
}
public function renderCommitMessageValue(array $handles) {
return PhabricatorEnv::getProductionURI('/D'.$this->getObject()->getID());
}
private static function parseRevisionIDFromURI($uri) {
$path = id(new PhutilURI($uri))->getPath();
$matches = null;
if (preg_match('#^/D(\d+)$#', $path, $matches)) {
$id = (int)$matches[1];
// Make sure the URI is the same as our URI. Basically, we want to ignore
// commits from other Phabricator installs.
if ($uri == PhabricatorEnv::getProductionURI('/D'.$id)) {
return $id;
}
$allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id);
foreach ($allowed_uris as $allowed_uri) {
if ($uri == $allowed_uri) {
return $id;
}
}
}
return null;
}
}

View file

@ -1,14 +0,0 @@
<?php
final class DifferentialFieldDataNotAvailableException extends Exception {
public function __construct(DifferentialFieldSpecification $spec) {
$key = $spec->getStorageKey();
$class = get_class($spec);
parent::__construct(
"Differential field specification for '{$key}' (of class '{$class}') is ".
"attempting to access data which is not available in this context.");
}
}

View file

@ -1,16 +0,0 @@
<?php
final class DifferentialFieldSpecificationIncompleteException
extends Exception {
public function __construct(DifferentialFieldSpecification $spec) {
$key = $spec->getStorageKey();
$class = get_class($spec);
parent::__construct(
"Differential field specification for '{$key}' (of class '{$class}') is ".
"incompletely implemented: it claims it should appear in a context but ".
"does not implement all the required methods for that context.");
}
}

View file

@ -1,19 +0,0 @@
<?php
final class DifferentialApplyPatchFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Apply Patch:';
}
public function renderValueForRevisionView() {
$revision = $this->getRevision();
return phutil_tag('tt', array(), 'arc patch D'.$revision->getID());
}
}

View file

@ -1,38 +0,0 @@
<?php
final class DifferentialArcanistProjectFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDs() {
$arcanist_phid = $this->getArcanistProjectPHID();
if (!$arcanist_phid) {
return array();
}
return array($arcanist_phid);
}
public function renderLabelForRevisionView() {
return 'Arcanist Project:';
}
public function renderValueForRevisionView() {
$arcanist_phid = $this->getArcanistProjectPHID();
if (!$arcanist_phid) {
return null;
}
$handle = $this->getHandle($arcanist_phid);
return $handle->getName();
}
private function getArcanistProjectPHID() {
$diff = $this->getDiff();
return $diff->getArcanistProjectPHID();
}
}

View file

@ -1,76 +0,0 @@
<?php
final class DifferentialAsanaRepresentationFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return (bool)PhabricatorEnv::getEnvConfig('asana.workspace-id');
}
public function renderLabelForRevisionView() {
return pht('In Asana:');
}
public function renderValueForRevisionView() {
$viewer = $this->getUser();
$src_phid = $this->getRevision()->getPHID();
$edge_type = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANATASK;
$query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($src_phid))
->withEdgeTypes(array($edge_type))
->needEdgeData(true);
$edges = $query->execute();
if (!$edges) {
return null;
}
$edge = head($edges[$src_phid][$edge_type]);
if (!empty($edge['data']['gone'])) {
return phutil_tag(
'em',
array(),
pht('Asana Task Deleted'));
}
$ref = id(new DoorkeeperImportEngine())
->setViewer($viewer)
->withPHIDs(array($edge['dst']))
->needLocalOnly(true)
->executeOne();
if (!$ref) {
return null;
}
$tag_id = celerity_generate_unique_node_id();
$xobj = $ref->getExternalObject();
$href = $xobj->getObjectURI();
Javelin::initBehavior(
'doorkeeper-tag',
array(
'tags' => array(
array(
'id' => $tag_id,
'ref' => array(
$ref->getApplicationType(),
$ref->getApplicationDomain(),
$ref->getObjectType(),
$ref->getObjectID(),
),
),
),
));
return id(new PHUITagView())
->setID($tag_id)
->setName($href)
->setHref($href)
->setType(PHUITagView::TYPE_OBJECT)
->setExternal(true);
}
}

View file

@ -1,67 +0,0 @@
<?php
final class DifferentialAuditorsFieldSpecification
extends DifferentialFieldSpecification {
private $auditors = array();
public function shouldAppearOnCommitMessage() {
return true;
}
public function shouldAppearOnCommitMessageTemplate() {
return false;
}
public function getCommitMessageKey() {
return 'auditorPHIDs';
}
public function setValueFromParsedCommitMessage($value) {
$this->auditors = nonempty($value, array());
return $this;
}
public function renderLabelForCommitMessage() {
return 'Auditors';
}
public function getRequiredHandlePHIDsForCommitMessage() {
return $this->auditors;
}
public function renderValueForCommitMessage($is_edit) {
if (!$this->auditors) {
return null;
}
$names = array();
foreach ($this->auditors as $phid) {
$names[] = $this->getHandle($phid)->getName();
}
return implode(', ', $names);
}
public function parseValueFromCommitMessage($value) {
return $this->parseCommitMessageUserList($value);
}
public function getStorageKey() {
return 'phabricator:auditors';
}
public function getValueForStorage() {
return json_encode($this->auditors);
}
public function setValueFromStorage($value) {
$auditors = json_decode($value, true);
if (!is_array($auditors)) {
$auditors = array();
}
$this->auditors = $auditors;
return $this;
}
}

View file

@ -1,44 +0,0 @@
<?php
final class DifferentialAuthorFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return array($this->getAuthorPHID());
}
public function renderLabelForRevisionView() {
return 'Author:';
}
public function renderValueForRevisionView() {
return $this->renderUserList(array($this->getAuthorPHID()));
}
private function getAuthorPHID() {
$revision = $this->getRevision();
return $revision->getAuthorPHID();
}
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Author';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return $this->getHandle($revision->getAuthorPHID())->renderLink();
}
public function getRequiredHandlePHIDsForRevisionList(
DifferentialRevision $revision) {
return array($revision->getAuthorPHID());
}
}

View file

@ -1,92 +0,0 @@
<?php
final class DifferentialBlameRevisionFieldSpecification
extends DifferentialFieldSpecification {
private $value;
public function getStorageKey() {
return 'phabricator:blame-revision';
}
public function getValueForStorage() {
return $this->value;
}
public function setValueFromStorage($value) {
$this->value = $value;
return $this;
}
public function shouldAppearOnEdit() {
return true;
}
public function setValueFromRequest(AphrontRequest $request) {
$this->value = $request->getStr($this->getStorageKey());
return $this;
}
public function renderEditControl() {
return id(new AphrontFormTextControl())
->setLabel(pht('Blame Revision'))
->setCaption(
pht('Revision which broke the stuff which this change fixes.'))
->setName($this->getStorageKey())
->setValue($this->value);
}
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return pht('Blame Revision:');
}
public function renderValueForRevisionView() {
if (!$this->value) {
return null;
}
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$engine->setConfig('viewer', $this->getUser());
return $engine->markupText($this->value);
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'blameRevision';
}
public function setValueFromParsedCommitMessage($value) {
$this->value = $value;
return $this;
}
public function shouldOverwriteWhenCommitMessageIsEdited() {
return true;
}
public function renderLabelForCommitMessage() {
return 'Blame Revision';
}
public function renderValueForCommitMessage($is_edit) {
return $this->value;
}
public function getSupportedCommitMessageLabels() {
return array(
'Blame Revision',
'Blame Rev',
);
}
public function parseValueFromCommitMessage($value) {
return $value;
}
}

View file

@ -1,34 +0,0 @@
<?php
final class DifferentialBranchFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Branch:';
}
private function getBranchOrBookmarkDescription(DifferentialDiff $diff) {
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();
$has_branch = ($branch != '');
$has_bookmark = ($bookmark != '');
if ($has_branch && $has_bookmark) {
return "{$bookmark} bookmark on {$branch} branch";
} else if ($has_bookmark) {
return "{$bookmark} bookmark";
} else if ($has_branch) {
return $branch;
}
return null;
}
public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
return $this->getBranchOrBookmarkDescription($diff);
}
}

View file

@ -1,106 +0,0 @@
<?php
final class DifferentialCCsFieldSpecification
extends DifferentialFieldSpecification {
private $ccs = array();
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getCCPHIDs();
}
public function renderLabelForRevisionView() {
return 'CCs:';
}
public function renderValueForRevisionView() {
return $this->renderUserList($this->getCCPHIDs());
}
private function getCCPHIDs() {
$revision = $this->getRevision();
return $revision->getCCPHIDs();
}
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->ccs = $this->getCCPHIDs();
}
public function getRequiredHandlePHIDsForRevisionEdit() {
return $this->ccs;
}
public function getRequiredHandlePHIDsForCommitMessage() {
return $this->ccs;
}
public function setValueFromRequest(AphrontRequest $request) {
$this->ccs = $request->getArr('cc');
return $this;
}
public function renderEditControl() {
$cc_map = array();
foreach ($this->ccs as $phid) {
$cc_map[] = $this->getHandle($phid);
}
return id(new AphrontFormTokenizerControl())
->setLabel('CC')
->setName('cc')
->setUser($this->getUser())
->setDatasource('/typeahead/common/mailable/')
->setValue($cc_map);
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'ccPHIDs';
}
public function setValueFromParsedCommitMessage($value) {
$this->ccs = array_unique(nonempty($value, array()));
return $this;
}
public function renderLabelForCommitMessage() {
return 'CC';
}
public function renderValueForCommitMessage($is_edit) {
if (!$this->ccs) {
return null;
}
$names = array();
foreach ($this->ccs as $phid) {
$handle = $this->getHandle($phid);
if ($handle->isComplete()) {
$names[] = $handle->getObjectName();
}
}
return implode(', ', $names);
}
public function getSupportedCommitMessageLabels() {
return array(
'CC',
'CCs',
);
}
public function parseValueFromCommitMessage($value) {
return $this->parseCommitMessageMailableList($value);
}
}

View file

@ -1,37 +0,0 @@
<?php
final class DifferentialCommitsFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getCommitPHIDs();
}
public function renderLabelForRevisionView() {
return 'Commits:';
}
public function renderValueForRevisionView() {
$commit_phids = $this->getCommitPHIDs();
if (!$commit_phids) {
return null;
}
$links = array();
foreach ($commit_phids as $commit_phid) {
$links[] = $this->getHandle($commit_phid)->renderLink();
}
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getCommitPHIDs() {
$revision = $this->getRevision();
return $revision->getCommitPHIDs();
}
}

View file

@ -1,34 +0,0 @@
<?php
final class DifferentialConflictsFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnCommitMessage() {
return true;
}
public function shouldAppearOnCommitMessageTemplate() {
return false;
}
public function getCommitMessageKey() {
return 'conflicts';
}
public function setValueFromParsedCommitMessage($value) {
return $this;
}
public function renderLabelForCommitMessage() {
return 'Conflicts';
}
public function renderValueForCommitMessage($is_edit) {
return null;
}
public function parseValueFromCommitMessage($value) {
return $value;
}
}

View file

@ -1,18 +0,0 @@
<?php
final class DifferentialDateCreatedFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Created';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return phabricator_date($revision->getDateCreated(), $this->getUser());
}
}

View file

@ -1,18 +0,0 @@
<?php
final class DifferentialDateModifiedFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Updated';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return phabricator_datetime($revision->getDateModified(), $this->getUser());
}
}

View file

@ -1,38 +0,0 @@
<?php
final class DifferentialDependenciesFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getDependentRevisionPHIDs();
}
public function renderLabelForRevisionView() {
return 'Dependents:';
}
public function renderValueForRevisionView() {
$revision_phids = $this->getDependentRevisionPHIDs();
if (!$revision_phids) {
return null;
}
$links = array();
foreach ($revision_phids as $revision_phids) {
$links[] = $this->getHandle($revision_phids)->renderLink();
}
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getDependentRevisionPHIDs() {
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$this->getRevision()->getPHID(),
PhabricatorEdgeConfig::TYPE_DREV_DEPENDED_ON_BY_DREV);
}
}

View file

@ -1,38 +0,0 @@
<?php
final class DifferentialDependsOnFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getDependentRevisionPHIDs();
}
public function renderLabelForRevisionView() {
return 'Depends On:';
}
public function renderValueForRevisionView() {
$revision_phids = $this->getDependentRevisionPHIDs();
if (!$revision_phids) {
return null;
}
$links = array();
foreach ($revision_phids as $revision_phid) {
$links[] = $this->getHandle($revision_phid)->renderLink();
}
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getDependentRevisionPHIDs() {
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$this->getRevision()->getPHID(),
PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV);
}
}

View file

@ -1,25 +0,0 @@
<?php
final class DifferentialDiffViewPolicyFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnDiffView() {
return true;
}
public function renderLabelForDiffView() {
return pht('Visible To');
}
public function renderValueForDiffView() {
$user = $this->getUser();
$diff = $this->getDiff();
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$user,
$diff);
return idx($descriptions, PhabricatorPolicyCapability::CAN_VIEW);
}
}

View file

@ -1,38 +0,0 @@
<?php
final class DifferentialEditPolicyFieldSpecification
extends DifferentialFieldSpecification {
private $value;
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->value = $this->getRevision()->getEditPolicy();
}
public function setValueFromRequest(AphrontRequest $request) {
$this->value = $request->getStr('editPolicy');
return $this;
}
public function renderEditControl() {
$viewer = $this->getUser();
$revision = $this->getRevision();
$policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
->setObject($revision)
->execute();
return id(new AphrontFormPolicyControl())
->setUser($viewer)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
->setPolicyObject($revision)
->setPolicies($policies)
->setName('editPolicy');
}
}

View file

@ -1,22 +0,0 @@
<?php
final class DifferentialExportPatchFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Export Patch:';
}
public function renderValueForRevisionView() {
$revision = $this->getRevision();
return phutil_tag(
'tt',
array(),
'arc export --revision '.$revision->getID());
}
}

View file

@ -1,903 +0,0 @@
<?php
/**
* Describes and implements the behavior for a custom field on Differential
* revisions. Along with other configuration, you can extend this class to add
* custom fields to Differential revisions and commit messages.
*
* Generally, you should implement all methods from the storage task and then
* the methods from one or more interface tasks.
*
* @task storage Field Storage
* @task edit Extending the Revision Edit Interface
* @task view Extending the Revision View Interface
* @task list Extending the Revision List Interface
* @task mail Extending the E-mail Interface
* @task commit Extending Commit Messages
* @task load Loading Additional Data
* @task context Contextual Data
*/
abstract class DifferentialFieldSpecification {
private $revision;
private $diff;
private $manualDiff;
private $handles;
private $diffProperties;
private $user;
/* -( Storage )------------------------------------------------------------ */
/**
* Return a unique string used to key storage of this field's value, like
* "mycompany.fieldname" or similar. You can return null (the default) to
* indicate that this field does not use any storage. This is appropriate for
* display fields, like @{class:DifferentialLinesFieldSpecification}. If you
* implement this, you must also implement @{method:getValueForStorage} and
* @{method:setValueFromStorage}.
*
* @return string|null Unique key which identifies this field in auxiliary
* field storage. Maximum length is 32. Alternatively,
* null (default) to indicate that this field does not
* use auxiliary field storage.
* @task storage
*/
public function getStorageKey() {
return null;
}
/**
* Return a serialized representation of the field value, appropriate for
* storing in auxiliary field storage. You must implement this method if
* you implement @{method:getStorageKey}.
*
* @return string Serialized field value.
* @task storage
*/
public function getValueForStorage() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Set the field's value given a serialized storage value. This is called
* when the field is loaded; if no data is available, the value will be
* null. You must implement this method if you implement
* @{method:getStorageKey}.
*
* @param string|null Serialized field representation (from
* @{method:getValueForStorage}) or null if no value has
* ever been stored.
* @return this
* @task storage
*/
public function setValueFromStorage($value) {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/* -( Extending the Revision Edit Interface )------------------------------ */
/**
* Determine if this field should appear on the "Edit Revision" interface. If
* you return true from this method, you must implement
* @{method:setValueFromRequest}, @{method:renderEditControl} and
* @{method:validateField}.
*
* For a concrete example of a field which implements an edit interface, see
* @{class:DifferentialRevertPlanFieldSpecification}.
*
* @return bool True to indicate that this field implements an edit interface.
* @task edit
*/
public function shouldAppearOnEdit() {
return false;
}
/**
* Set the field's value from an HTTP request. Generally, you should read
* the value of some field name you emitted in @{method:renderEditControl}
* and save it into the object, e.g.:
*
* $this->value = $request->getStr('my-custom-field');
*
* If you have some particularly complicated field, you may need to read
* more data; this is why you have access to the entire request.
*
* You must implement this if you implement @{method:shouldAppearOnEdit}.
*
* You should not perform field validation here; instead, you should implement
* @{method:validateField}.
*
* @param AphrontRequest HTTP request representing a user submitting a form
* with this field in it.
* @return this
* @task edit
*/
public function setValueFromRequest(AphrontRequest $request) {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Build a renderable object (generally, some @{class:AphrontFormControl})
* which can be appended to a @{class:AphrontFormView} and represents the
* interface the user sees on the "Edit Revision" screen when interacting
* with this field.
*
* For example:
*
* return id(new AphrontFormTextControl())
* ->setLabel('Custom Field')
* ->setName('my-custom-key')
* ->setValue($this->value);
*
* You must implement this if you implement @{method:shouldAppearOnEdit}.
*
* @return AphrontView|string Something renderable.
* @task edit
*/
public function renderEditControl() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Optionally, build a preview panel for the field which will appear on the
* edit interface. This is used for the "Summary" field, but custom fields
* generally need not implement it.
*
* @return AphrontView|string Something renderable.
* @task edit
*/
public function renderEditPreview() {
return null;
}
/**
* This method will be called after @{method:setValueFromRequest} but before
* the field is saved. It gives you an opportunity to inspect the field value
* and throw a @{class:DifferentialFieldValidationException} if there is a
* problem with the value the user has provided (for example, the value the
* user entered is not correctly formatted). This method is also called after
* @{method:setValueFromParsedCommitMessage} before the revision is saved.
*
* By default, fields are not validated.
*
* @return void
* @task edit
*/
public function validateField() {
return;
}
/**
* Determine if user mentions should be extracted from the value and added to
* CC when creating revision. Mentions are then extracted from the string
* returned by @{method:renderValueForCommitMessage}.
*
* By default, mentions are not extracted.
*
* @return bool
* @task edit
*/
public function shouldExtractMentions() {
return false;
}
/* -( Extending the Revision View Interface )------------------------------ */
/**
* Determine if this field should appear on the revision detail view
* interface. One use of this interface is to add purely informational
* fields to the revision view, without any sort of backing storage.
*
* If you return true from this method, you must implement the methods
* @{method:renderLabelForRevisionView} and
* @{method:renderValueForRevisionView}.
*
* @return bool True if this field should appear when viewing a revision.
* @task view
*/
public function shouldAppearOnRevisionView() {
return false;
}
/**
* Return a string field label which will appear in the revision detail
* table.
*
* You must implement this method if you return true from
* @{method:shouldAppearOnRevisionView}.
*
* @return string Label for field in revision detail view.
* @task view
*/
public function renderLabelForRevisionView() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Return a markup block representing the field for the revision detail
* view. Note that you can return null to suppress display (for instance,
* if the field shows related objects of some type and the revision doesn't
* have any related objects).
*
* You must implement this method if you return true from
* @{method:shouldAppearOnRevisionView}.
*
* @return string|null Display markup for field value, or null to suppress
* field rendering.
* @task view
*/
public function renderValueForRevisionView() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Load users, their current statuses and return a markup with links to the
* user profiles and information about their current status.
*
* @return string Display markup.
* @task view
*/
public function renderUserList(array $user_phids) {
if (!$user_phids) {
return phutil_tag('em', array(), pht('None'));
}
return implode_selected_handle_links(', ',
$this->getLoadedHandles(), $user_phids);
}
/**
* Return a markup block representing a warning to display with the comment
* box when preparing to accept a diff. A return value of null indicates no
* warning box should be displayed for this field.
*
* @return string|null Display markup for warning box, or null for no warning
*/
public function renderWarningBoxForRevisionAccept() {
return null;
}
/* -( Extending the Revision List Interface )------------------------------ */
/**
* Determine if this field should appear in the table on the revision list
* interface.
*
* @return bool True if this field should appear in the table.
*
* @task list
*/
public function shouldAppearOnRevisionList() {
return false;
}
/**
* Return a column header for revision list tables.
*
* @return string Column header.
*
* @task list
*/
public function renderHeaderForRevisionList() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Optionally, return a column class for revision list tables.
*
* @return string CSS class for table cells.
*
* @task list
*/
public function getColumnClassForRevisionList() {
return null;
}
/**
* Return a table cell value for revision list tables.
*
* @param DifferentialRevision The revision to render a value for.
* @return string Table cell value.
*
* @task list
*/
public function renderValueForRevisionList(DifferentialRevision $revision) {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/* -( Extending the Diff View Interface )------------------------------ */
/**
* Determine if this field should appear on the diff detail view
* interface. One use of this interface is to add purely informational
* fields to the diff view, without any sort of backing storage.
*
* NOTE: These diffs are not necessarily attached yet to a revision.
* As such, a field on the diff view can not rely on the existence of a
* revision or use storage attached to the revision.
*
* If you return true from this method, you must implement the methods
* @{method:renderLabelForDiffView} and
* @{method:renderValueForDiffView}.
*
* @return bool True if this field should appear when viewing a diff.
* @task view
*/
public function shouldAppearOnDiffView() {
return false;
}
/**
* Return a string field label which will appear in the diff detail
* table.
*
* You must implement this method if you return true from
* @{method:shouldAppearOnDiffView}.
*
* @return string Label for field in revision detail view.
* @task view
*/
public function renderLabelForDiffView() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Return a markup block representing the field for the diff detail
* view. Note that you can return null to suppress display (for instance,
* if the field shows related objects of some type and the revision doesn't
* have any related objects).
*
* You must implement this method if you return true from
* @{method:shouldAppearOnDiffView}.
*
* @return string|null Display markup for field value, or null to suppress
* field rendering.
* @task view
*/
public function renderValueForDiffView() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/* -( Extending the Search Interface )------------------------------------ */
/**
* @task search
*/
public function shouldAddToSearchIndex() {
return false;
}
/**
* @task search
*/
public function getValueForSearchIndex() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* NOTE: Keys *must be* 4 characters for
* @{class:PhabricatorSearchEngineMySQL}.
*
* @task search
*/
public function getKeyForSearchIndex() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/* -( Extending Commit Messages )------------------------------------------ */
/**
* Determine if this field should appear in commit messages. You should return
* true if this field participates in any part of the commit message workflow,
* even if it is not rendered by default.
*
* If you implement this method, you must implement
* @{method:getCommitMessageKey} and
* @{method:setValueFromParsedCommitMessage}.
*
* @return bool True if this field appears in commit messages in any capacity.
* @task commit
*/
public function shouldAppearOnCommitMessage() {
return false;
}
/**
* Key which identifies this field in parsed commit messages. Commit messages
* exist in two forms: raw textual commit messages and parsed dictionaries of
* fields. This method must return a unique string which identifies this field
* in dictionaries. Principally, this dictionary is shipped to and from arc
* over Conduit. Keys should be appropriate property names, like "testPlan"
* (not "Test Plan") and must be globally unique.
*
* You must implement this method if you return true from
* @{method:shouldAppearOnCommitMessage}.
*
* @return string Key which identifies the field in dictionaries.
* @task commit
*/
public function getCommitMessageKey() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Set this field's value from a value in a parsed commit message dictionary.
* Afterward, this field will go through the normal write workflows and the
* change will be permanently stored via either the storage mechanisms (if
* your field implements them), revision write hooks (if your field implements
* them) or discarded (if your field implements neither, e.g. is just a
* display field).
*
* The value you receive will either be null or something you originally
* returned from @{method:parseValueFromCommitMessage}.
*
* You must implement this method if you return true from
* @{method:shouldAppearOnCommitMessage}.
*
* @param mixed Field value from a parsed commit message dictionary.
* @return this
* @task commit
*/
public function setValueFromParsedCommitMessage($value) {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* In revision control systems which read revision information from the
* working copy, the user may edit the commit message outside of invoking
* "arc diff --edit". When they do this, only some fields (those fields which
* can not be edited by other users) are safe to overwrite. For instance, it
* is fine to overwrite "Summary" because no one else can edit it, but not
* to overwrite "Reviewers" because reviewers may have been added or removed
* via the web interface.
*
* If a field is safe to overwrite when edited in a working copy commit
* message, return true. If the authoritative value should always be used,
* return false. By default, fields can not be overwritten.
*
* arc will only attempt to overwrite field values if run with "--verbatim".
*
* @return bool True to indicate the field is save to overwrite.
* @task commit
*/
public function shouldOverwriteWhenCommitMessageIsEdited() {
return false;
}
/**
* Return true if this field should be suggested to the user during
* "arc diff --edit". Basicially, return true if the field is something the
* user might want to fill out (like "Summary"), and false if it's a
* system/display/readonly field (like "Differential Revision"). If this
* method returns true, the field will be rendered even if it has no value
* during edit and update operations.
*
* @return bool True to indicate the field should appear in the edit template.
* @task commit
*/
public function shouldAppearOnCommitMessageTemplate() {
return true;
}
/**
* Render a human-readable label for this field, like "Summary" or
* "Test Plan". This is distinct from the commit message key, but generally
* they should be similar.
*
* @return string Human-readable field label for commit messages.
* @task commit
*/
public function renderLabelForCommitMessage() {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Render a human-readable value for this field when it appears in commit
* messages (for instance, lists of users should be rendered as user names).
*
* The ##$is_edit## parameter allows you to distinguish between commit
* messages being rendered for editing and those being rendered for amending
* or commit. Some fields may decline to render a value in one mode (for
* example, "Reviewed By" appears only when doing commit/amend, not while
* editing).
*
* @param bool True if the message is being edited.
* @return string Human-readable field value.
* @task commit
*/
public function renderValueForCommitMessage($is_edit) {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/**
* Return one or more labels which this field parses in commit messages. For
* example, you might parse all of "Task", "Tasks" and "Task Numbers" or
* similar. This is just to make it easier to get commit messages to parse
* when users are typing in the fields manually as opposed to using a
* template, by accepting alternate spellings / pluralizations / etc. By
* default, only the label returned from @{method:renderLabelForCommitMessage}
* is parsed.
*
* @return list List of supported labels that this field can parse from commit
* messages.
* @task commit
*/
public function getSupportedCommitMessageLabels() {
return array($this->renderLabelForCommitMessage());
}
/**
* Parse a raw text block from a commit message into a canonical
* representation of the field value. For example, the "CC" field accepts a
* comma-delimited list of usernames and emails and parses them into valid
* PHIDs, emitting a PHID list.
*
* If you encounter errors (like a nonexistent username) while parsing,
* you should throw a @{class:DifferentialFieldParseException}.
*
* Generally, this method should accept whatever you return from
* @{method:renderValueForCommitMessage} and parse it back into a sensible
* representation.
*
* You must implement this method if you return true from
* @{method:shouldAppearOnCommitMessage}.
*
* @param string
* @return mixed The canonical representation of the field value. For example,
* you should lookup usernames and object references.
* @task commit
*/
public function parseValueFromCommitMessage($value) {
throw new DifferentialFieldSpecificationIncompleteException($this);
}
/* -( Loading Additional Data )-------------------------------------------- */
/**
* Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your
* field to render correctly.
*
* This is a convenience method which makes the handles available on all
* interfaces where the field appears. If your field needs handles on only
* some interfaces (or needs different handles on different interfaces) you
* can overload the more specific methods to customize which interfaces you
* retrieve handles for. Requesting only the handles you need will improve
* the performance of your field.
*
* You can later retrieve these handles by calling @{method:getHandle}.
*
* @return list List of PHIDs to load handles for.
* @task load
*/
protected function getRequiredHandlePHIDs() {
return array();
}
/**
* Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your
* field to render correctly on the view interface.
*
* This is a more specific version of @{method:getRequiredHandlePHIDs} which
* can be overridden to improve field performance by loading only data you
* need.
*
* @return list List of PHIDs to load handles for.
* @task load
*/
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getRequiredHandlePHIDs();
}
/**
* Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your
* field to render correctly on the list interface.
*
* This is a more specific version of @{method:getRequiredHandlePHIDs} which
* can be overridden to improve field performance by loading only data you
* need.
*
* @param DifferentialRevision The revision to pull PHIDs for.
* @return list List of PHIDs to load handles for.
* @task load
*/
public function getRequiredHandlePHIDsForRevisionList(
DifferentialRevision $revision) {
return array();
}
/**
* Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your
* field to render correctly on the edit interface.
*
* This is a more specific version of @{method:getRequiredHandlePHIDs} which
* can be overridden to improve field performance by loading only data you
* need.
*
* @return list List of PHIDs to load handles for.
* @task load
*/
public function getRequiredHandlePHIDsForRevisionEdit() {
return $this->getRequiredHandlePHIDs();
}
/**
* Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your
* field to render correctly on the commit message interface.
*
* This is a more specific version of @{method:getRequiredHandlePHIDs} which
* can be overridden to improve field performance by loading only data you
* need.
*
* @return list List of PHIDs to load handles for.
* @task load
*/
public function getRequiredHandlePHIDsForCommitMessage() {
return $this->getRequiredHandlePHIDs();
}
/**
* Parse a list of users into a canonical PHID list.
*
* @param string Raw list of comma-separated user names.
* @return list List of corresponding PHIDs.
* @task load
*/
protected function parseCommitMessageUserList($value) {
return $this->parseCommitMessageObjectList($value, $mailables = false);
}
protected function parseCommitMessageUserOrProjectList($value) {
return $this->parseCommitMessageObjectList(
$value,
$mailables = false,
$allow_partial = false);
}
/**
* Parse a list of mailable objects into a canonical PHID list.
*
* @param string Raw list of comma-separated mailable names.
* @return list List of corresponding PHIDs.
* @task load
*/
protected function parseCommitMessageMailableList($value) {
return $this->parseCommitMessageObjectList($value, $mailables = true);
}
/**
* Parse and lookup a list of object names, converting them to PHIDs.
*
* @param string Raw list of comma-separated object names.
* @param bool True to include mailing lists.
* @param bool True to make a best effort. By default, an exception is
* thrown if any item is invalid.
* @return list List of corresponding PHIDs.
* @task load
*/
public static function parseCommitMessageObjectList(
$value,
$include_mailables,
$allow_partial = false) {
$types = array(
PhabricatorPeoplePHIDTypeUser::TYPECONST,
PhabricatorProjectPHIDTypeProject::TYPECONST,
);
if ($include_mailables) {
$types[] = PhabricatorMailingListPHIDTypeList::TYPECONST;
}
return id(new PhabricatorObjectListQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->setAllowPartialResults($allow_partial)
->setAllowedTypes($types)
->setObjectList($value)
->execute();
}
/* -( Contextual Data )---------------------------------------------------- */
/**
* @task context
*/
final public function setRevision(DifferentialRevision $revision) {
$this->revision = $revision;
$this->didSetRevision();
return $this;
}
/**
* @task context
*/
protected function didSetRevision() {
return;
}
/**
* @task context
*/
final public function setDiff(DifferentialDiff $diff) {
$this->diff = $diff;
return $this;
}
/**
* @task context
*/
final public function setManualDiff(DifferentialDiff $diff) {
$this->manualDiff = $diff;
return $this;
}
/**
* @task context
*/
final public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
/**
* @task context
*/
final public function setDiffProperties(array $diff_properties) {
$this->diffProperties = $diff_properties;
return $this;
}
/**
* @task context
*/
final public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
/**
* @task context
*/
final protected function getRevision() {
if (empty($this->revision)) {
throw new DifferentialFieldDataNotAvailableException($this);
}
return $this->revision;
}
/**
* Determine if revision context is currently available.
*
* @task context
*/
final protected function hasRevision() {
return (bool)$this->revision;
}
/**
* @task context
*/
final protected function getDiff() {
if (empty($this->diff)) {
throw new DifferentialFieldDataNotAvailableException($this);
}
return $this->diff;
}
/**
* @task context
*/
final protected function getManualDiff() {
if (!$this->manualDiff) {
return $this->getDiff();
}
return $this->manualDiff;
}
/**
* @task context
*/
final protected function getUser() {
if (empty($this->user)) {
throw new DifferentialFieldDataNotAvailableException($this);
}
return $this->user;
}
/**
* Get the handle for an object PHID. You must overload
* @{method:getRequiredHandlePHIDs} (or a more specific version thereof)
* and include the PHID you want in the list for it to be available here.
*
* @return PhabricatorObjectHandle Handle to the object.
* @task context
*/
final protected function getHandle($phid) {
if ($this->handles === null) {
throw new DifferentialFieldDataNotAvailableException($this);
}
if (empty($this->handles[$phid])) {
$class = get_class($this);
throw new Exception(
"A differential field (of class '{$class}') is attempting to retrieve ".
"a handle ('{$phid}') which it did not request. Return all handle ".
"PHIDs you need from getRequiredHandlePHIDs().");
}
return $this->handles[$phid];
}
final protected function getLoadedHandles() {
if ($this->handles === null) {
throw new DifferentialFieldDataNotAvailableException($this);
}
return $this->handles;
}
/**
* Get the list of properties for a diff set by @{method:setManualDiff}.
*
* @return array Array of all Diff properties.
* @task context
*/
final public function getDiffProperties() {
if ($this->diffProperties === null) {
// This will be set to some (possibly empty) array if we've loaded
// properties, so null means diff properties aren't available in this
// context.
throw new DifferentialFieldDataNotAvailableException($this);
}
return $this->diffProperties;
}
/**
* Get a property of a diff set by @{method:setManualDiff}.
*
* @param string Diff property key.
* @return mixed|null Diff property, or null if the property does not have
* a value.
* @task context
*/
final public function getDiffProperty($key) {
return idx($this->getDiffProperties(), $key);
}
}

View file

@ -1,6 +0,0 @@
<?php
abstract class DifferentialFreeformFieldSpecification
extends DifferentialFieldSpecification {
}

View file

@ -1,37 +0,0 @@
<?php
final class DifferentialGitSVNIDFieldSpecification
extends DifferentialFieldSpecification {
private $gitSVNID;
public function shouldAppearOnCommitMessage() {
return true;
}
public function shouldAppearOnCommitMessageTemplate() {
return false;
}
public function getCommitMessageKey() {
return 'gitSVNID';
}
public function setValueFromParsedCommitMessage($value) {
$this->gitSVNID = $value;
return $this;
}
public function renderLabelForCommitMessage() {
return 'git-svn-id';
}
public function renderValueForCommitMessage($is_edit) {
return null;
}
public function parseValueFromCommitMessage($value) {
return $value;
}
}

View file

@ -1,6 +0,0 @@
<?php
final class DifferentialHostFieldSpecification
extends DifferentialFieldSpecification {
}

View file

@ -1,162 +0,0 @@
<?php
final class DifferentialJIRAIssuesFieldSpecification
extends DifferentialFieldSpecification {
private $value;
private $error;
public function getStorageKey() {
return 'phabricator:jira-issues';
}
public function getValueForStorage() {
return json_encode($this->value);
}
public function setValueFromStorage($value) {
if (!strlen($value)) {
$this->value = array();
} else {
$this->value = json_decode($value, true);
}
return $this;
}
public function shouldAppearOnEdit() {
return true;
}
public function setValueFromRequest(AphrontRequest $request) {
$this->value = $request->getStrList($this->getStorageKey());
return $this;
}
public function renderEditControl() {
return id(new AphrontFormTextControl())
->setLabel(pht('JIRA Issues'))
->setCaption(
pht('Example: %s', phutil_tag('tt', array(), 'JIS-3, JIS-9')))
->setName($this->getStorageKey())
->setValue(implode(', ', nonempty($this->value, array())))
->setError($this->error);
}
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return pht('JIRA Issues:');
}
public function renderValueForRevisionView() {
$xobjs = $this->loadDoorkeeperExternalObjects();
if (!$xobjs) {
return null;
}
$links = array();
foreach ($xobjs as $xobj) {
$links[] = id(new DoorkeeperTagView())
->setExternalObject($xobj);
}
return phutil_implode_html(phutil_tag('br'), $links);
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'jira.issues';
}
public function setValueFromParsedCommitMessage($value) {
$this->value = $value;
return $this;
}
public function shouldOverwriteWhenCommitMessageIsEdited() {
return true;
}
public function renderLabelForCommitMessage() {
return 'JIRA Issues';
}
public function renderValueForCommitMessage($is_edit) {
return implode(', ', $this->value);
}
public function getSupportedCommitMessageLabels() {
return array(
'JIRA',
'JIRA Issues',
'JIRA Issue',
);
}
public function parseValueFromCommitMessage($value) {
return preg_split('/[\s,]+/', $value, $limit = -1, PREG_SPLIT_NO_EMPTY);
}
public function validateField() {
if ($this->value) {
$refs = id(new DoorkeeperImportEngine())
->setViewer($this->getUser())
->setRefs($this->buildDoorkeeperRefs())
->execute();
$bad = array();
foreach ($refs as $ref) {
if (!$ref->getIsVisible()) {
$bad[] = $ref->getObjectID();
}
}
if ($bad) {
$bad = implode(', ', $bad);
$this->error = pht('Invalid');
throw new DifferentialFieldValidationException(
pht(
"Some JIRA issues could not be loaded. They may not exist, or ".
"you may not have permission to view them: %s",
$bad));
}
}
}
private function buildDoorkeeperRefs() {
$provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider();
$refs = array();
if ($this->value) {
foreach ($this->value as $jira_key) {
$refs[] = id(new DoorkeeperObjectRef())
->setApplicationType(DoorkeeperBridgeJIRA::APPTYPE_JIRA)
->setApplicationDomain($provider->getProviderDomain())
->setObjectType(DoorkeeperBridgeJIRA::OBJTYPE_ISSUE)
->setObjectID($jira_key);
}
}
return $refs;
}
private function loadDoorkeeperExternalObjects() {
$refs = $this->buildDoorkeeperRefs();
if (!$refs) {
return array();
}
$xobjs = id(new DoorkeeperExternalObjectQuery())
->setViewer($this->getUser())
->withObjectKeys(mpull($refs, 'getObjectKey'))
->execute();
return $xobjs;
}
}

View file

@ -1,35 +0,0 @@
<?php
final class DifferentialLinesFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Lines:';
}
public function renderValueForRevisionView() {
$diff = $this->getDiff();
return number_format($diff->getLineCount());
}
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Lines';
}
public function getColumnClassForRevisionList() {
return 'n';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return number_format($revision->getLineCount());
}
}

View file

@ -1,234 +1,6 @@
<?php
final class DifferentialLintFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnDiffView() {
return true;
}
public function renderLabelForDiffView() {
return $this->renderLabelForRevisionView();
}
public function renderValueForDiffView() {
return $this->renderValueForRevisionView();
}
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Lint:';
}
private function getLintExcuse() {
return $this->getDiffProperty('arc:lint-excuse');
}
private function getPostponedLinters() {
return $this->getDiffProperty('arc:lint-postponed');
}
public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
$path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename');
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
$ldata = $this->getDiffProperty('arc:lint');
$ltail = null;
$rows = array();
$rows[] = array(
'style' => 'star',
'name' => $lstar,
'value' => $lmsg,
'show' => true,
);
$excuse = $this->getLintExcuse();
if ($excuse) {
$rows[] = array(
'style' => 'excuse',
'name' => 'Excuse',
'value' => phutil_escape_html_newlines($excuse),
'show' => true,
);
}
$show_limit = 10;
$hidden = array();
if ($ldata) {
$ldata = igroup($ldata, 'path');
foreach ($ldata as $path => $messages) {
$rows[] = array(
'style' => 'section',
'name' => $path,
'show' => $show_limit,
);
foreach ($messages as $message) {
$path = idx($message, 'path');
$line = idx($message, 'line');
$code = idx($message, 'code');
$severity = idx($message, 'severity');
$name = idx($message, 'name');
$description = idx($message, 'description');
$line_link = 'line '.intval($line);
if (isset($path_changesets[$path])) {
$href = '#C'.$path_changesets[$path].'NL'.max(1, $line);
if ($diff->getID() != $this->getDiff()->getID()) {
$href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href;
}
$line_link = phutil_tag(
'a',
array(
'href' => $href,
),
$line_link);
}
if ($show_limit) {
--$show_limit;
$show = true;
} else {
$show = false;
if (empty($hidden[$severity])) {
$hidden[$severity] = 0;
}
$hidden[$severity]++;
}
$rows[] = array(
'style' => $this->getSeverityStyle($severity),
'name' => ucwords($severity),
'value' => hsprintf(
'(%s) %s at %s',
$code,
$name,
$line_link),
'show' => $show,
);
if (!empty($message['locations'])) {
$locations = array();
foreach ($message['locations'] as $location) {
$other_line = idx($location, 'line');
$locations[] =
idx($location, 'path', $path).
($other_line ? ":{$other_line}" : "");
}
$description .= "\nOther locations: ".implode(", ", $locations);
}
if (strlen($description)) {
$rows[] = array(
'style' => 'details',
'value' => phutil_escape_html_newlines($description),
'show' => false,
);
if (empty($hidden['details'])) {
$hidden['details'] = 0;
}
$hidden['details']++;
}
}
}
}
$postponed = $this->getPostponedLinters();
if ($postponed) {
foreach ($postponed as $linter) {
$rows[] = array(
'style' => $this->getPostponedStyle(),
'name' => 'Postponed',
'value' => $linter,
'show' => false,
);
if (empty($hidden['postponed'])) {
$hidden['postponed'] = 0;
}
$hidden['postponed']++;
}
}
$show_string = $this->renderShowString($hidden);
$view = new DifferentialResultsTableView();
$view->setRows($rows);
$view->setShowMoreString($show_string);
return $view->render();
}
private function getSeverityStyle($severity) {
$map = array(
ArcanistLintSeverity::SEVERITY_ERROR => 'red',
ArcanistLintSeverity::SEVERITY_WARNING => 'yellow',
ArcanistLintSeverity::SEVERITY_AUTOFIX => 'yellow',
ArcanistLintSeverity::SEVERITY_ADVICE => 'yellow',
);
return idx($map, $severity);
}
private function getPostponedStyle() {
return 'blue';
}
private function renderShowString(array $hidden) {
if (!$hidden) {
return null;
}
// Reorder hidden things by severity.
$hidden = array_select_keys(
$hidden,
array(
ArcanistLintSeverity::SEVERITY_ERROR,
ArcanistLintSeverity::SEVERITY_WARNING,
ArcanistLintSeverity::SEVERITY_AUTOFIX,
ArcanistLintSeverity::SEVERITY_ADVICE,
'details',
'postponed',
)) + $hidden;
$show = array();
foreach ($hidden as $key => $value) {
switch ($key) {
case ArcanistLintSeverity::SEVERITY_ERROR:
$show[] = pht('%d Error(s)', $value);
break;
case ArcanistLintSeverity::SEVERITY_WARNING:
$show[] = pht('%d Warning(s)', $value);
break;
case ArcanistLintSeverity::SEVERITY_AUTOFIX:
$show[] = pht('%d Auto-Fix(es)', $value);
break;
case ArcanistLintSeverity::SEVERITY_ADVICE:
$show[] = pht('%d Advice(s)', $value);
break;
case 'details':
$show[] = pht('%d Detail(s)', $value);
break;
case 'postponed':
$show[] = pht('%d Postponed', $value);
break;
default:
$show[] = $value;
break;
}
}
return "Show Full Lint Results (".implode(', ', $show).")";
}
final class DifferentialLintFieldSpecification {
public function renderWarningBoxForRevisionAccept() {
$status = $this->getDiff()->getLintStatus();

View file

@ -1,130 +0,0 @@
<?php
final class DifferentialManiphestTasksFieldSpecification
extends DifferentialFieldSpecification {
private $oldManiphestTasks = array();
private $maniphestTasks = array();
public function shouldAppearOnRevisionView() {
return PhabricatorApplication::isClassInstalled(
'PhabricatorApplicationManiphest');
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getManiphestTaskPHIDs();
}
public function renderLabelForRevisionView() {
return 'Maniphest Tasks:';
}
public function renderValueForRevisionView() {
$task_phids = $this->getManiphestTaskPHIDs();
if (!$task_phids) {
return null;
}
$links = array();
foreach ($task_phids as $task_phid) {
$links[] = $this->getHandle($task_phid)->renderLink();
}
return phutil_implode_html(phutil_tag('br'), $links);
}
private function getManiphestTaskPHIDs() {
$revision = $this->getRevision();
if (!$revision->getPHID()) {
return array();
}
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$revision->getPHID(),
PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK);
}
protected function didSetRevision() {
$this->maniphestTasks = $this->getManiphestTaskPHIDs();
$this->oldManiphestTasks = $this->maniphestTasks;
}
public function getRequiredHandlePHIDsForCommitMessage() {
return $this->maniphestTasks;
}
public function shouldAppearOnCommitMessageTemplate() {
return false;
}
public function shouldAppearOnCommitMessage() {
return $this->shouldAppearOnRevisionView();
}
public function getCommitMessageKey() {
return 'maniphestTaskPHIDs';
}
public function setValueFromParsedCommitMessage($value) {
$this->maniphestTasks = array_unique(nonempty($value, array()));
return $this;
}
public function renderLabelForCommitMessage() {
return 'Maniphest Tasks';
}
public function getSupportedCommitMessageLabels() {
return array(
'Maniphest Task',
'Maniphest Tasks',
);
}
public function renderValueForCommitMessage($is_edit) {
if (!$this->maniphestTasks) {
return null;
}
$names = array();
foreach ($this->maniphestTasks as $phid) {
$handle = $this->getHandle($phid);
$names[] = $handle->getName();
}
return implode(', ', $names);
}
public function parseValueFromCommitMessage($value) {
$matches = null;
preg_match_all('/T(\d+)/', $value, $matches);
if (empty($matches[0])) {
return array();
}
// TODO: T603 Get a viewer here so we can issue the right query.
$task_ids = $matches[1];
$tasks = id(new ManiphestTask())
->loadAllWhere('id in (%Ld)', $task_ids);
$task_phids = array();
$invalid = array();
foreach ($task_ids as $task_id) {
$task = idx($tasks, $task_id);
if (empty($task)) {
$invalid[] = 'T'.$task_id;
} else {
$task_phids[] = $task->getPHID();
}
}
if ($invalid) {
$what = pht('Maniphest Task(s)', count($invalid));
$invalid = implode(', ', $invalid);
throw new DifferentialFieldParseException(
"Commit message references nonexistent {$what}: {$invalid}.");
}
return $task_phids;
}
}

View file

@ -1,6 +0,0 @@
<?php
final class DifferentialPathFieldSpecification
extends DifferentialFieldSpecification {
}

View file

@ -1,43 +0,0 @@
<?php
final class DifferentialProjectReviewersFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getRevision()->getReviewers();
}
public function renderLabelForRevisionView() {
return pht('Project Reviewers');
}
public function renderValueForRevisionView() {
$reviewers = array();
foreach ($this->getRevision()->getReviewerStatus() as $reviewer) {
if (!$reviewer->isUser()) {
$reviewers[] = $reviewer;
}
}
if (!$reviewers) {
return null;
}
$view = id(new DifferentialReviewersView())
->setUser($this->getUser())
->setReviewers($reviewers)
->setHandles($this->getLoadedHandles());
$diff = $this->getRevision()->loadActiveDiff();
if ($diff) {
$view->setActiveDiff($diff);
}
return $view;
}
}

View file

@ -1,44 +0,0 @@
<?php
final class DifferentialRepositoryFieldSpecification
extends DifferentialFieldSpecification {
private $value;
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->value = $this->getRevision()->getRepositoryPHID();
}
public function setValueFromRequest(AphrontRequest $request) {
$value = head($request->getArr('repositoryPHID'));
$this->value = nonempty($value, null);
return $this;
}
public function getRequiredHandlePHIDsForRevisionEdit() {
return array_filter(array($this->value));
}
public function renderEditControl() {
$value = array();
if ($this->value) {
$value = array(
$this->getHandle($this->value),
);
}
return id(new AphrontFormTokenizerControl())
->setLabel('Repository')
->setName('repositoryPHID')
->setUser($this->getUser())
->setLimit(1)
->setDatasource('/typeahead/common/repositories/')
->setValue($value);
}
}

View file

@ -1,102 +0,0 @@
<?php
final class DifferentialRevertPlanFieldSpecification
extends DifferentialFieldSpecification {
private $value;
public function getStorageKey() {
return 'phabricator:revert-plan';
}
public function getValueForStorage() {
return $this->value;
}
public function setValueFromStorage($value) {
$this->value = $value;
return $this;
}
public function shouldAppearOnEdit() {
return true;
}
public function setValueFromRequest(AphrontRequest $request) {
$this->value = $request->getStr($this->getStorageKey());
return $this;
}
public function renderEditControl() {
return id(new AphrontFormTextAreaControl())
->setLabel('Revert Plan')
->setName($this->getStorageKey())
->setCaption('Special steps required to safely revert this change.')
->setValue($this->value);
}
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Revert Plan:';
}
public function renderValueForRevisionView() {
if (!$this->value) {
return null;
}
return $this->value;
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'revertPlan';
}
public function setValueFromParsedCommitMessage($value) {
$this->value = $value;
return $this;
}
public function shouldOverwriteWhenCommitMessageIsEdited() {
return true;
}
public function renderLabelForCommitMessage() {
return 'Revert Plan';
}
public function renderValueForCommitMessage($is_edit) {
return $this->value;
}
public function getSupportedCommitMessageLabels() {
return array(
'Revert Plan',
'Revert',
);
}
public function parseValueFromCommitMessage($value) {
return $value;
}
public function shouldAddToSearchIndex() {
return true;
}
public function getValueForSearchIndex() {
return $this->value;
}
public function getKeyForSearchIndex() {
return 'rpln';
}
}

View file

@ -1,64 +0,0 @@
<?php
final class DifferentialReviewedByFieldSpecification
extends DifferentialFieldSpecification {
private $reviewedBy;
protected function didSetRevision() {
$this->reviewedBy = array();
$revision = $this->getRevision();
$reviewer = $revision->loadReviewedBy();
if ($reviewer) {
$this->reviewedBy = array($reviewer);
}
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'reviewedByPHIDs';
}
public function setValueFromParsedCommitMessage($value) {
$this->reviewedBy = $value;
return $this;
}
public function shouldAppearOnCommitMessageTemplate() {
return false;
}
public function renderLabelForCommitMessage() {
return 'Reviewed By';
}
public function getRequiredHandlePHIDsForCommitMessage() {
return $this->reviewedBy;
}
public function renderValueForCommitMessage($is_edit) {
if ($is_edit) {
return null;
}
if (!$this->reviewedBy) {
return null;
}
$names = array();
foreach ($this->reviewedBy as $phid) {
$names[] = $this->getHandle($phid)->getName();
}
return implode(', ', $names);
}
public function parseValueFromCommitMessage($value) {
return $this->parseCommitMessageUserList($value);
}
}

View file

@ -1,176 +0,0 @@
<?php
final class DifferentialReviewersFieldSpecification
extends DifferentialFieldSpecification {
private $reviewers = array();
private $error;
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDsForRevisionView() {
return $this->getReviewerPHIDs();
}
public function renderLabelForRevisionView() {
return pht('Reviewers');
}
public function renderValueForRevisionView() {
$reviewers = array();
foreach ($this->getRevision()->getReviewerStatus() as $reviewer) {
if ($reviewer->isUser()) {
$reviewers[] = $reviewer;
}
}
if (!$reviewers) {
// Renders "None".
return $this->renderUserList(array());
}
$view = id(new DifferentialReviewersView())
->setUser($this->getUser())
->setReviewers($reviewers)
->setHandles($this->getLoadedHandles());
$diff = $this->getRevision()->loadActiveDiff();
if ($diff) {
$view->setActiveDiff($diff);
}
return $view;
}
private function getReviewerPHIDs() {
$revision = $this->getRevision();
return $revision->getReviewers();
}
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->reviewers = $this->getReviewerPHIDs();
}
public function getRequiredHandlePHIDsForRevisionEdit() {
return $this->reviewers;
}
public function setValueFromRequest(AphrontRequest $request) {
$this->reviewers = $request->getArr('reviewers');
return $this;
}
public function validateField() {
if (!$this->hasRevision()) {
return;
}
$self = PhabricatorEnv::getEnvConfig('differential.allow-self-accept');
if ($self) {
return;
}
$author_phid = $this->getRevision()->getAuthorPHID();
if (!in_array($author_phid, $this->reviewers)) {
return;
}
$this->error = 'Invalid';
throw new DifferentialFieldValidationException(
"The owner of a revision may not be a reviewer.");
}
public function renderEditControl() {
$reviewer_map = array();
foreach ($this->reviewers as $phid) {
$reviewer_map[] = $this->getHandle($phid);
}
return id(new AphrontFormTokenizerControl())
->setLabel(pht('Reviewers'))
->setName('reviewers')
->setUser($this->getUser())
->setDatasource('/typeahead/common/usersorprojects/')
->setValue($reviewer_map)
->setError($this->error);
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'reviewerPHIDs';
}
public function setValueFromParsedCommitMessage($value) {
$this->reviewers = array_unique(nonempty($value, array()));
return $this;
}
public function renderLabelForCommitMessage() {
return 'Reviewers';
}
public function getRequiredHandlePHIDsForCommitMessage() {
return $this->reviewers;
}
public function renderValueForCommitMessage($is_edit) {
if (!$this->reviewers) {
return null;
}
$names = array();
foreach ($this->reviewers as $phid) {
$names[] = $this->getHandle($phid)->getObjectName();
}
return implode(', ', $names);
}
public function getSupportedCommitMessageLabels() {
return array(
'Reviewer',
'Reviewers',
);
}
public function parseValueFromCommitMessage($value) {
return $this->parseCommitMessageUserOrProjectList($value);
}
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Reviewers';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
$primary_reviewer = $revision->getPrimaryReviewer();
if ($primary_reviewer) {
$names = array();
foreach ($revision->getReviewers() as $reviewer) {
$names[] = $this->getHandle($reviewer)->renderLink();
}
return phutil_implode_html(', ', $names);
} else {
return phutil_tag('em', array(), 'None');
}
}
public function getRequiredHandlePHIDsForRevisionList(
DifferentialRevision $revision) {
return $revision->getReviewers();
}
}

View file

@ -1,99 +0,0 @@
<?php
final class DifferentialRevisionIDFieldSpecification
extends DifferentialFieldSpecification {
private $id;
protected function didSetRevision() {
$this->id = $this->getRevision()->getID();
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function shouldAppearOnCommitMessageTemplate() {
return false;
}
public function getCommitMessageKey() {
return 'revisionID';
}
public function setValueFromParsedCommitMessage($value) {
$this->id = $value;
return $this;
}
public function renderLabelForCommitMessage() {
return 'Differential Revision';
}
public function renderValueForCommitMessage($is_edit) {
if (!$this->id) {
return null;
}
return PhabricatorEnv::getProductionURI('/D'.$this->id);
}
public function parseValueFromCommitMessage($value) {
$rev = trim(head(explode("\n", $value)));
if (!strlen($rev)) {
return null;
}
if (is_numeric($rev)) {
// TODO: Eventually, remove support for bare revision numbers.
return (int)$rev;
}
$rev = self::parseRevisionIDFromURI($rev);
if ($rev !== null) {
return $rev;
}
$example_uri = PhabricatorEnv::getProductionURI('/D123');
throw new DifferentialFieldParseException(
"Commit references invalid 'Differential Revision'. Expected a ".
"Phabricator URI like '{$example_uri}', got '{$value}'.");
}
public static function parseRevisionIDFromURI($uri) {
$path = id(new PhutilURI($uri))->getPath();
$matches = null;
if (preg_match('#^/D(\d+)$#', $path, $matches)) {
$id = (int)$matches[1];
// Make sure the URI is the same as our URI. Basically, we want to ignore
// commits from other Phabricator installs.
if ($uri == PhabricatorEnv::getProductionURI('/D'.$id)) {
return $id;
}
$allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id);
foreach ($allowed_uris as $allowed_uri) {
if ($uri == $allowed_uri) {
return $id;
}
}
}
return null;
}
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'ID';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return 'D'.$revision->getID();
}
}

View file

@ -1,23 +0,0 @@
<?php
final class DifferentialRevisionStatusFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return false;
}
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Status';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
$revision->getStatus());
}
}

View file

@ -1,89 +0,0 @@
<?php
final class DifferentialSummaryFieldSpecification
extends DifferentialFreeformFieldSpecification {
private $summary = '';
private $controlID;
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->summary = (string)$this->getRevision()->getSummary();
}
public function setValueFromRequest(AphrontRequest $request) {
$this->summary = $request->getStr('summary');
return $this;
}
public function renderEditControl() {
return id(new PhabricatorRemarkupControl())
->setLabel(pht('Summary'))
->setName('summary')
->setID($this->getControlID())
->setValue($this->summary);
}
public function renderEditPreview() {
return id(new PHUIRemarkupPreviewPanel())
->setHeader(pht('Summary Preview'))
->setControlID($this->getControlID())
->setPreviewURI('/differential/preview/');
}
public function shouldExtractMentions() {
return true;
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'summary';
}
public function setValueFromParsedCommitMessage($value) {
$this->summary = (string)$value;
return $this;
}
public function shouldOverwriteWhenCommitMessageIsEdited() {
return true;
}
public function renderLabelForCommitMessage() {
return 'Summary';
}
public function renderValueForCommitMessage($is_edit) {
return $this->summary;
}
public function parseValueFromCommitMessage($value) {
return (string)$value;
}
public function shouldAddToSearchIndex() {
return true;
}
public function getValueForSearchIndex() {
return $this->summary;
}
public function getKeyForSearchIndex() {
return PhabricatorSearchField::FIELD_BODY;
}
private function getControlID() {
if (!$this->controlID) {
$this->controlID = celerity_generate_unique_node_id();
}
return $this->controlID;
}
}

View file

@ -1,112 +0,0 @@
<?php
final class DifferentialTestPlanFieldSpecification
extends DifferentialFieldSpecification {
private $plan = '';
// NOTE: This means "uninitialized".
private $error = false;
public function shouldAppearOnEdit() {
return false;
}
protected function didSetRevision() {
$this->plan = (string)$this->getRevision()->getTestPlan();
}
public function setValueFromRequest(AphrontRequest $request) {
$this->plan = $request->getStr('testplan');
$this->error = null;
return $this;
}
public function renderEditControl() {
if ($this->error === false) {
if ($this->isRequired()) {
$this->error = true;
} else {
$this->error = null;
}
}
return id(new PhabricatorRemarkupControl())
->setLabel('Test Plan')
->setName('testplan')
->setValue($this->plan)
->setError($this->error);
}
public function shouldExtractMentions() {
return true;
}
public function validateField() {
if ($this->isRequired()) {
if (!strlen($this->plan)) {
$this->error = 'Required';
throw new DifferentialFieldValidationException(
"You must provide a test plan.");
}
}
}
public function shouldAppearOnCommitMessage() {
return false;
}
public function getCommitMessageKey() {
return 'testPlan';
}
public function setValueFromParsedCommitMessage($value) {
$this->plan = (string)$value;
return $this;
}
public function shouldOverwriteWhenCommitMessageIsEdited() {
return true;
}
public function renderLabelForCommitMessage() {
return 'Test Plan';
}
public function getSupportedCommitMessageLabels() {
return array(
'Test Plan',
'Testplan',
'Tested',
'Tests',
);
}
public function renderValueForCommitMessage($is_edit) {
return $this->plan;
}
public function parseValueFromCommitMessage($value) {
return $value;
}
public function shouldAddToSearchIndex() {
return true;
}
public function getValueForSearchIndex() {
return $this->plan;
}
public function getKeyForSearchIndex() {
return 'tpln';
}
private function isRequired() {
return PhabricatorEnv::getEnvConfig('differential.require-test-plan-field');
}
}

View file

@ -1,107 +0,0 @@
<?php
final class DifferentialTitleFieldSpecification
extends DifferentialFreeformFieldSpecification {
private $title;
private $error = true;
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->title = $this->getRevision()->getTitle();
}
public function setValueFromRequest(AphrontRequest $request) {
$this->title = $request->getStr('title');
$this->error = null;
return $this;
}
public function renderEditControl() {
return id(new AphrontFormTextAreaControl())
->setLabel('Title')
->setName('title')
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)
->setError($this->error)
->setValue($this->title);
}
public function shouldExtractMentions() {
return true;
}
public function validateField() {
if (!strlen($this->title)) {
$this->error = 'Required';
throw new DifferentialFieldValidationException(
"You must provide a revision title in the first line ".
"of your commit message.");
}
if (preg_match('/^<<.*>>$/', $this->title)) {
$default_title = self::getDefaultRevisionTitle();
$this->error = 'Required';
throw new DifferentialFieldValidationException(
"Replace the line '{$default_title}' with a revision title ".
"that describes the change.");
}
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function getCommitMessageKey() {
return 'title';
}
public function setValueFromParsedCommitMessage($value) {
$this->title = $value;
return $this;
}
public function shouldOverwriteWhenCommitMessageIsEdited() {
return true;
}
public function renderLabelForCommitMessage() {
return 'Title';
}
public function renderValueForCommitMessage($is_edit) {
return $this->title;
}
public function parseValueFromCommitMessage($value) {
return preg_replace('/\s*\n\s*/', ' ', $value);
}
public function shouldAppearOnRevisionList() {
return true;
}
public function renderHeaderForRevisionList() {
return 'Revision';
}
public function getColumnClassForRevisionList() {
return 'wide pri';
}
public static function getDefaultRevisionTitle() {
return '<<Replace this line with your Revision Title>>';
}
public function renderValueForRevisionList(DifferentialRevision $revision) {
return phutil_tag(
'a',
array(
'href' => '/D'.$revision->getID(),
),
$revision->getTitle());
}
}

View file

@ -1,204 +1,6 @@
<?php
final class DifferentialUnitFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnDiffView() {
return true;
}
public function renderLabelForDiffView() {
return $this->renderLabelForRevisionView();
}
public function renderValueForDiffView() {
return $this->renderValueForRevisionView();
}
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Unit:';
}
private function getUnitExcuse() {
return $this->getDiffProperty('arc:unit-excuse');
}
public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
$ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
$umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
$rows = array();
$rows[] = array(
'style' => 'star',
'name' => $ustar,
'value' => $umsg,
'show' => true,
);
$excuse = $this->getUnitExcuse();
if ($excuse) {
$rows[] = array(
'style' => 'excuse',
'name' => 'Excuse',
'value' => phutil_escape_html_newlines($excuse),
'show' => true,
);
}
$show_limit = 10;
$hidden = array();
$udata = $this->getDiffProperty('arc:unit');
if ($udata) {
$sort_map = array(
ArcanistUnitTestResult::RESULT_BROKEN => 0,
ArcanistUnitTestResult::RESULT_FAIL => 1,
ArcanistUnitTestResult::RESULT_UNSOUND => 2,
ArcanistUnitTestResult::RESULT_SKIP => 3,
ArcanistUnitTestResult::RESULT_POSTPONED => 4,
ArcanistUnitTestResult::RESULT_PASS => 5,
);
foreach ($udata as $key => $test) {
$udata[$key]['sort'] = idx($sort_map, idx($test, 'result'));
}
$udata = isort($udata, 'sort');
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($this->getUser());
$markup_objects = array();
foreach ($udata as $key => $test) {
$userdata = idx($test, 'userdata');
if ($userdata) {
if ($userdata !== false) {
$userdata = str_replace("\000", '', $userdata);
}
$markup_object = id(new PhabricatorMarkupOneOff())
->setContent($userdata)
->setPreserveLinebreaks(true);
$engine->addObject($markup_object, 'default');
$markup_objects[$key] = $markup_object;
}
}
$engine->process();
foreach ($udata as $key => $test) {
$result = idx($test, 'result');
$default_hide = false;
switch ($result) {
case ArcanistUnitTestResult::RESULT_POSTPONED:
case ArcanistUnitTestResult::RESULT_PASS:
$default_hide = true;
break;
}
if ($show_limit && !$default_hide) {
--$show_limit;
$show = true;
} else {
$show = false;
if (empty($hidden[$result])) {
$hidden[$result] = 0;
}
$hidden[$result]++;
}
$value = idx($test, 'name');
if (!empty($test['link'])) {
$value = phutil_tag(
'a',
array(
'href' => $test['link'],
'target' => '_blank',
),
$value);
}
$rows[] = array(
'style' => $this->getResultStyle($result),
'name' => ucwords($result),
'value' => $value,
'show' => $show,
);
if (isset($markup_objects[$key])) {
$rows[] = array(
'style' => 'details',
'value' => $engine->getOutput($markup_objects[$key], 'default'),
'show' => false,
);
if (empty($hidden['details'])) {
$hidden['details'] = 0;
}
$hidden['details']++;
}
}
}
$show_string = $this->renderShowString($hidden);
$view = new DifferentialResultsTableView();
$view->setRows($rows);
$view->setShowMoreString($show_string);
return $view->render();
}
private function getResultStyle($result) {
$map = array(
ArcanistUnitTestResult::RESULT_PASS => 'green',
ArcanistUnitTestResult::RESULT_FAIL => 'red',
ArcanistUnitTestResult::RESULT_SKIP => 'blue',
ArcanistUnitTestResult::RESULT_BROKEN => 'red',
ArcanistUnitTestResult::RESULT_UNSOUND => 'yellow',
ArcanistUnitTestResult::RESULT_POSTPONED => 'blue',
);
return idx($map, $result);
}
private function renderShowString(array $hidden) {
if (!$hidden) {
return null;
}
// Reorder hidden things by severity.
$hidden = array_select_keys(
$hidden,
array(
ArcanistUnitTestResult::RESULT_BROKEN,
ArcanistUnitTestResult::RESULT_FAIL,
ArcanistUnitTestResult::RESULT_UNSOUND,
ArcanistUnitTestResult::RESULT_SKIP,
ArcanistUnitTestResult::RESULT_POSTPONED,
ArcanistUnitTestResult::RESULT_PASS,
'details',
)) + $hidden;
$noun = array(
ArcanistUnitTestResult::RESULT_BROKEN => 'Broken',
ArcanistUnitTestResult::RESULT_FAIL => 'Failed',
ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound',
ArcanistUnitTestResult::RESULT_SKIP => 'Skipped',
ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed',
ArcanistUnitTestResult::RESULT_PASS => 'Passed',
);
$show = array();
foreach ($hidden as $key => $value) {
if ($key == 'details') {
$show[] = pht('%d Detail(s)', $value);
} else {
$show[] = $value.' '.idx($noun, $key);
}
}
return "Show Full Unit Results (".implode(', ', $show).")";
}
final class DifferentialUnitFieldSpecification {
public function renderWarningBoxForRevisionAccept() {
$diff = $this->getDiff();

View file

@ -1,38 +0,0 @@
<?php
final class DifferentialViewPolicyFieldSpecification
extends DifferentialFieldSpecification {
private $value;
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->value = $this->getRevision()->getViewPolicy();
}
public function setValueFromRequest(AphrontRequest $request) {
$this->value = $request->getStr('viewPolicy');
return $this;
}
public function renderEditControl() {
$viewer = $this->getUser();
$revision = $this->getRevision();
$policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
->setObject($revision)
->execute();
return id(new AphrontFormPolicyControl())
->setUser($viewer)
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
->setPolicyObject($revision)
->setPolicies($policies)
->setName('viewPolicy');
}
}

View file

@ -1,32 +0,0 @@
<?php
final class DifferentialRevisionIDFieldParserTestCase
extends PhabricatorTestCase {
public function testFieldParser() {
$this->assertEqual(
null,
$this->parse('123'));
$this->assertEqual(
null,
$this->parse('D123'));
// NOTE: We expect foreign, validly-formatted URIs to be ignored.
$this->assertEqual(
null,
$this->parse('http://phabricator.example.com/D123'));
$this->assertEqual(
123,
$this->parse(PhabricatorEnv::getProductionURI('/D123')));
}
private function parse($value) {
return DifferentialRevisionIDFieldSpecification::parseRevisionIDFromURI(
$value);
}
}

View file

@ -1,40 +0,0 @@
<?php
final class DifferentialAuxiliaryField {
public static function loadFromStorage(
DifferentialRevision $revision,
array $aux_fields) {
assert_instances_of($aux_fields, 'DifferentialFieldSpecification');
$storage_keys = array_filter(mpull($aux_fields, 'getStorageKey'));
$field_data = array();
if ($storage_keys) {
$index_map = array();
foreach ($storage_keys as $key) {
$index_map[PhabricatorHash::digestForIndex($key)] = $key;
}
$index_data = id(new DifferentialCustomFieldStorage())->loadAllWhere(
'objectPHID = %s AND fieldIndex IN (%Ls)',
$revision->getPHID(),
array_keys($index_map));
$index_data = mpull($index_data, 'getFieldValue', 'getFieldIndex');
foreach ($index_data as $index => $data) {
$field_data[$index_map[$index]] = $data;
}
}
foreach ($aux_fields as $aux_field) {
$aux_field->setRevision($revision);
$key = $aux_field->getStorageKey();
if ($key) {
$aux_field->setValueFromStorage(idx($field_data, $key));
}
}
return $aux_fields;
}
}

View file

@ -16,8 +16,9 @@
* button.)
*
*/
final class DifferentialReleephRequestFieldSpecification
extends DifferentialFieldSpecification {
final class DifferentialReleephRequestFieldSpecification {
// TODO: This class is essentially dead right now, see T2222.
const ACTION_PICKS = 'picks';
const ACTION_REVERTS = 'reverts';