@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+30 -3541
-81
src/__phutil_library_map__.php
··· 321 321 'DifferentialAddCommentView' => 'applications/differential/view/DifferentialAddCommentView.php', 322 322 'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php', 323 323 'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php', 324 - 'DifferentialApplyPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php', 325 324 'DifferentialArcanistProjectField' => 'applications/differential/customfield/DifferentialArcanistProjectField.php', 326 - 'DifferentialArcanistProjectFieldSpecification' => 'applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php', 327 325 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php', 328 - 'DifferentialAsanaRepresentationFieldSpecification' => 'applications/differential/field/specification/DifferentialAsanaRepresentationFieldSpecification.php', 329 326 'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php', 330 - 'DifferentialAuditorsFieldSpecification' => 'applications/differential/field/specification/DifferentialAuditorsFieldSpecification.php', 331 327 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php', 332 - 'DifferentialAuthorFieldSpecification' => 'applications/differential/field/specification/DifferentialAuthorFieldSpecification.php', 333 - 'DifferentialAuxiliaryField' => 'applications/differential/storage/DifferentialAuxiliaryField.php', 334 328 'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php', 335 - 'DifferentialBlameRevisionFieldSpecification' => 'applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php', 336 329 'DifferentialBranchField' => 'applications/differential/customfield/DifferentialBranchField.php', 337 - 'DifferentialBranchFieldSpecification' => 'applications/differential/field/specification/DifferentialBranchFieldSpecification.php', 338 - 'DifferentialCCsFieldSpecification' => 'applications/differential/field/specification/DifferentialCCsFieldSpecification.php', 339 330 'DifferentialCapabilityDefaultView' => 'applications/differential/capability/DifferentialCapabilityDefaultView.php', 340 331 'DifferentialChangeType' => 'applications/differential/constants/DifferentialChangeType.php', 341 332 'DifferentialChangeset' => 'applications/differential/storage/DifferentialChangeset.php', ··· 359 350 'DifferentialCommitMessageParser' => 'applications/differential/parser/DifferentialCommitMessageParser.php', 360 351 'DifferentialCommitMessageParserTestCase' => 'applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php', 361 352 'DifferentialCommitsField' => 'applications/differential/customfield/DifferentialCommitsField.php', 362 - 'DifferentialCommitsFieldSpecification' => 'applications/differential/field/specification/DifferentialCommitsFieldSpecification.php', 363 353 'DifferentialConflictsField' => 'applications/differential/customfield/DifferentialConflictsField.php', 364 - 'DifferentialConflictsFieldSpecification' => 'applications/differential/field/specification/DifferentialConflictsFieldSpecification.php', 365 354 'DifferentialController' => 'applications/differential/controller/DifferentialController.php', 366 355 'DifferentialCoreCustomField' => 'applications/differential/customfield/DifferentialCoreCustomField.php', 367 356 'DifferentialCustomField' => 'applications/differential/customfield/DifferentialCustomField.php', ··· 373 362 'DifferentialCustomFieldStorage' => 'applications/differential/storage/DifferentialCustomFieldStorage.php', 374 363 'DifferentialCustomFieldStringIndex' => 'applications/differential/storage/DifferentialCustomFieldStringIndex.php', 375 364 'DifferentialDAO' => 'applications/differential/storage/DifferentialDAO.php', 376 - 'DifferentialDateCreatedFieldSpecification' => 'applications/differential/field/specification/DifferentialDateCreatedFieldSpecification.php', 377 - 'DifferentialDateModifiedFieldSpecification' => 'applications/differential/field/specification/DifferentialDateModifiedFieldSpecification.php', 378 365 'DifferentialDependenciesField' => 'applications/differential/customfield/DifferentialDependenciesField.php', 379 - 'DifferentialDependenciesFieldSpecification' => 'applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php', 380 366 'DifferentialDependsOnField' => 'applications/differential/customfield/DifferentialDependsOnField.php', 381 - 'DifferentialDependsOnFieldSpecification' => 'applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php', 382 367 'DifferentialDiff' => 'applications/differential/storage/DifferentialDiff.php', 383 368 'DifferentialDiffCreateController' => 'applications/differential/controller/DifferentialDiffCreateController.php', 384 369 'DifferentialDiffProperty' => 'applications/differential/storage/DifferentialDiffProperty.php', ··· 386 371 'DifferentialDiffTableOfContentsView' => 'applications/differential/view/DifferentialDiffTableOfContentsView.php', 387 372 'DifferentialDiffTestCase' => 'applications/differential/storage/__tests__/DifferentialDiffTestCase.php', 388 373 'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php', 389 - 'DifferentialDiffViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialDiffViewPolicyFieldSpecification.php', 390 374 'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php', 391 375 'DifferentialDraft' => 'applications/differential/storage/DifferentialDraft.php', 392 376 'DifferentialEditPolicyField' => 'applications/differential/customfield/DifferentialEditPolicyField.php', 393 - 'DifferentialEditPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialEditPolicyFieldSpecification.php', 394 377 'DifferentialException' => 'applications/differential/exception/DifferentialException.php', 395 378 'DifferentialExceptionMail' => 'applications/differential/mail/DifferentialExceptionMail.php', 396 - 'DifferentialExportPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php', 397 - 'DifferentialFieldDataNotAvailableException' => 'applications/differential/field/exception/DifferentialFieldDataNotAvailableException.php', 398 379 'DifferentialFieldParseException' => 'applications/differential/field/exception/DifferentialFieldParseException.php', 399 - 'DifferentialFieldSpecification' => 'applications/differential/field/specification/DifferentialFieldSpecification.php', 400 - 'DifferentialFieldSpecificationIncompleteException' => 'applications/differential/field/exception/DifferentialFieldSpecificationIncompleteException.php', 401 380 'DifferentialFieldValidationException' => 'applications/differential/field/exception/DifferentialFieldValidationException.php', 402 - 'DifferentialFreeformFieldSpecification' => 'applications/differential/field/specification/DifferentialFreeformFieldSpecification.php', 403 381 'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php', 404 382 'DifferentialGitSVNIDField' => 'applications/differential/customfield/DifferentialGitSVNIDField.php', 405 - 'DifferentialGitSVNIDFieldSpecification' => 'applications/differential/field/specification/DifferentialGitSVNIDFieldSpecification.php', 406 383 'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php', 407 - 'DifferentialHostFieldSpecification' => 'applications/differential/field/specification/DifferentialHostFieldSpecification.php', 408 384 'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php', 409 385 'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.php', 410 386 'DifferentialHunkParser' => 'applications/differential/parser/DifferentialHunkParser.php', ··· 417 393 'DifferentialInlineCommentQuery' => 'applications/differential/query/DifferentialInlineCommentQuery.php', 418 394 'DifferentialInlineCommentView' => 'applications/differential/view/DifferentialInlineCommentView.php', 419 395 'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php', 420 - 'DifferentialJIRAIssuesFieldSpecification' => 'applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php', 421 396 'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php', 422 397 'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php', 423 398 'DifferentialLandingToGitHub' => 'applications/differential/landing/DifferentialLandingToGitHub.php', 424 399 'DifferentialLandingToHostedGit' => 'applications/differential/landing/DifferentialLandingToHostedGit.php', 425 400 'DifferentialLandingToHostedMercurial' => 'applications/differential/landing/DifferentialLandingToHostedMercurial.php', 426 - 'DifferentialLinesFieldSpecification' => 'applications/differential/field/specification/DifferentialLinesFieldSpecification.php', 427 401 'DifferentialLintField' => 'applications/differential/customfield/DifferentialLintField.php', 428 402 'DifferentialLintFieldSpecification' => 'applications/differential/field/specification/DifferentialLintFieldSpecification.php', 429 403 'DifferentialLintStatus' => 'applications/differential/constants/DifferentialLintStatus.php', ··· 431 405 'DifferentialMail' => 'applications/differential/mail/DifferentialMail.php', 432 406 'DifferentialMailPhase' => 'applications/differential/constants/DifferentialMailPhase.php', 433 407 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php', 434 - 'DifferentialManiphestTasksFieldSpecification' => 'applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php', 435 408 'DifferentialPHIDTypeDiff' => 'applications/differential/phid/DifferentialPHIDTypeDiff.php', 436 409 'DifferentialPHIDTypeRevision' => 'applications/differential/phid/DifferentialPHIDTypeRevision.php', 437 410 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 438 411 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', 439 412 'DifferentialPathField' => 'applications/differential/customfield/DifferentialPathField.php', 440 - 'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/DifferentialPathFieldSpecification.php', 441 413 'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php', 442 414 'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php', 443 - 'DifferentialProjectReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialProjectReviewersFieldSpecification.php', 444 415 'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php', 445 416 'DifferentialReleephRequestFieldSpecification' => 'applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php', 446 417 'DifferentialRemarkupRule' => 'applications/differential/remarkup/DifferentialRemarkupRule.php', 447 418 'DifferentialReplyHandler' => 'applications/differential/mail/DifferentialReplyHandler.php', 448 419 'DifferentialRepositoryField' => 'applications/differential/customfield/DifferentialRepositoryField.php', 449 - 'DifferentialRepositoryFieldSpecification' => 'applications/differential/field/specification/DifferentialRepositoryFieldSpecification.php', 450 420 'DifferentialRepositoryLookup' => 'applications/differential/query/DifferentialRepositoryLookup.php', 451 421 'DifferentialResultsTableView' => 'applications/differential/view/DifferentialResultsTableView.php', 452 422 'DifferentialRevertPlanField' => 'applications/differential/customfield/DifferentialRevertPlanField.php', 453 - 'DifferentialRevertPlanFieldSpecification' => 'applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php', 454 423 'DifferentialReviewedByField' => 'applications/differential/customfield/DifferentialReviewedByField.php', 455 - 'DifferentialReviewedByFieldSpecification' => 'applications/differential/field/specification/DifferentialReviewedByFieldSpecification.php', 456 424 'DifferentialReviewer' => 'applications/differential/storage/DifferentialReviewer.php', 457 425 'DifferentialReviewerStatus' => 'applications/differential/constants/DifferentialReviewerStatus.php', 458 426 'DifferentialReviewersField' => 'applications/differential/customfield/DifferentialReviewersField.php', 459 - 'DifferentialReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialReviewersFieldSpecification.php', 460 427 'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php', 461 428 'DifferentialRevision' => 'applications/differential/storage/DifferentialRevision.php', 462 429 'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php', 463 430 'DifferentialRevisionDetailView' => 'applications/differential/view/DifferentialRevisionDetailView.php', 464 431 'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php', 465 432 'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php', 466 - 'DifferentialRevisionIDFieldParserTestCase' => 'applications/differential/field/specification/__tests__/DifferentialRevisionIDFieldParserTestCase.php', 467 - 'DifferentialRevisionIDFieldSpecification' => 'applications/differential/field/specification/DifferentialRevisionIDFieldSpecification.php', 468 433 'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php', 469 434 'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php', 470 435 'DifferentialRevisionListView' => 'applications/differential/view/DifferentialRevisionListView.php', ··· 472 437 'DifferentialRevisionQuery' => 'applications/differential/query/DifferentialRevisionQuery.php', 473 438 'DifferentialRevisionSearchEngine' => 'applications/differential/query/DifferentialRevisionSearchEngine.php', 474 439 'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php', 475 - 'DifferentialRevisionStatusFieldSpecification' => 'applications/differential/field/specification/DifferentialRevisionStatusFieldSpecification.php', 476 440 'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/DifferentialRevisionUpdateHistoryView.php', 477 441 'DifferentialRevisionViewController' => 'applications/differential/controller/DifferentialRevisionViewController.php', 478 442 'DifferentialSearchIndexer' => 'applications/differential/search/DifferentialSearchIndexer.php', 479 443 'DifferentialStoredCustomField' => 'applications/differential/customfield/DifferentialStoredCustomField.php', 480 444 'DifferentialSubscribersField' => 'applications/differential/customfield/DifferentialSubscribersField.php', 481 445 'DifferentialSummaryField' => 'applications/differential/customfield/DifferentialSummaryField.php', 482 - 'DifferentialSummaryFieldSpecification' => 'applications/differential/field/specification/DifferentialSummaryFieldSpecification.php', 483 446 'DifferentialTasksAttacher' => 'applications/differential/DifferentialTasksAttacher.php', 484 447 'DifferentialTestPlanField' => 'applications/differential/customfield/DifferentialTestPlanField.php', 485 - 'DifferentialTestPlanFieldSpecification' => 'applications/differential/field/specification/DifferentialTestPlanFieldSpecification.php', 486 448 'DifferentialTitleField' => 'applications/differential/customfield/DifferentialTitleField.php', 487 - 'DifferentialTitleFieldSpecification' => 'applications/differential/field/specification/DifferentialTitleFieldSpecification.php', 488 449 'DifferentialTransaction' => 'applications/differential/storage/DifferentialTransaction.php', 489 450 'DifferentialTransactionComment' => 'applications/differential/storage/DifferentialTransactionComment.php', 490 451 'DifferentialTransactionEditor' => 'applications/differential/editor/DifferentialTransactionEditor.php', ··· 495 456 'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php', 496 457 'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php', 497 458 'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php', 498 - 'DifferentialViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialViewPolicyFieldSpecification.php', 499 459 'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php', 500 460 'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php', 501 461 'DiffusionBrowseController' => 'applications/diffusion/controller/DiffusionBrowseController.php', ··· 2891 2851 'DifferentialAddCommentView' => 'AphrontView', 2892 2852 'DifferentialAffectedPath' => 'DifferentialDAO', 2893 2853 'DifferentialApplyPatchField' => 'DifferentialCustomField', 2894 - 'DifferentialApplyPatchFieldSpecification' => 'DifferentialFieldSpecification', 2895 2854 'DifferentialArcanistProjectField' => 'DifferentialCustomField', 2896 - 'DifferentialArcanistProjectFieldSpecification' => 'DifferentialFieldSpecification', 2897 2855 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', 2898 - 'DifferentialAsanaRepresentationFieldSpecification' => 'DifferentialFieldSpecification', 2899 2856 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', 2900 - 'DifferentialAuditorsFieldSpecification' => 'DifferentialFieldSpecification', 2901 2857 'DifferentialAuthorField' => 'DifferentialCustomField', 2902 - 'DifferentialAuthorFieldSpecification' => 'DifferentialFieldSpecification', 2903 2858 'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField', 2904 - 'DifferentialBlameRevisionFieldSpecification' => 'DifferentialFieldSpecification', 2905 2859 'DifferentialBranchField' => 'DifferentialCustomField', 2906 - 'DifferentialBranchFieldSpecification' => 'DifferentialFieldSpecification', 2907 - 'DifferentialCCsFieldSpecification' => 'DifferentialFieldSpecification', 2908 2860 'DifferentialCapabilityDefaultView' => 'PhabricatorPolicyCapability', 2909 2861 'DifferentialChangeset' => 'DifferentialDAO', 2910 2862 'DifferentialChangesetDetailView' => 'AphrontView', ··· 2923 2875 'DifferentialCommentSaveController' => 'DifferentialController', 2924 2876 'DifferentialCommitMessageParserTestCase' => 'PhabricatorTestCase', 2925 2877 'DifferentialCommitsField' => 'DifferentialCustomField', 2926 - 'DifferentialCommitsFieldSpecification' => 'DifferentialFieldSpecification', 2927 2878 'DifferentialConflictsField' => 'DifferentialCustomField', 2928 - 'DifferentialConflictsFieldSpecification' => 'DifferentialFieldSpecification', 2929 2879 'DifferentialController' => 'PhabricatorController', 2930 2880 'DifferentialCoreCustomField' => 'DifferentialCustomField', 2931 2881 'DifferentialCustomField' => 'PhabricatorCustomField', ··· 2937 2887 'DifferentialCustomFieldStorage' => 'PhabricatorCustomFieldStorage', 2938 2888 'DifferentialCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage', 2939 2889 'DifferentialDAO' => 'PhabricatorLiskDAO', 2940 - 'DifferentialDateCreatedFieldSpecification' => 'DifferentialFieldSpecification', 2941 - 'DifferentialDateModifiedFieldSpecification' => 'DifferentialFieldSpecification', 2942 2890 'DifferentialDependenciesField' => 'DifferentialCustomField', 2943 - 'DifferentialDependenciesFieldSpecification' => 'DifferentialFieldSpecification', 2944 2891 'DifferentialDependsOnField' => 'DifferentialCustomField', 2945 - 'DifferentialDependsOnFieldSpecification' => 'DifferentialFieldSpecification', 2946 2892 'DifferentialDiff' => 2947 2893 array( 2948 2894 0 => 'DifferentialDAO', ··· 2955 2901 'DifferentialDiffTableOfContentsView' => 'AphrontView', 2956 2902 'DifferentialDiffTestCase' => 'ArcanistPhutilTestCase', 2957 2903 'DifferentialDiffViewController' => 'DifferentialController', 2958 - 'DifferentialDiffViewPolicyFieldSpecification' => 'DifferentialFieldSpecification', 2959 2904 'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher', 2960 2905 'DifferentialDraft' => 'DifferentialDAO', 2961 2906 'DifferentialEditPolicyField' => 'DifferentialCoreCustomField', 2962 - 'DifferentialEditPolicyFieldSpecification' => 'DifferentialFieldSpecification', 2963 2907 'DifferentialException' => 'Exception', 2964 2908 'DifferentialExceptionMail' => 'DifferentialMail', 2965 - 'DifferentialExportPatchFieldSpecification' => 'DifferentialFieldSpecification', 2966 - 'DifferentialFieldDataNotAvailableException' => 'Exception', 2967 2909 'DifferentialFieldParseException' => 'Exception', 2968 - 'DifferentialFieldSpecificationIncompleteException' => 'Exception', 2969 2910 'DifferentialFieldValidationException' => 'Exception', 2970 - 'DifferentialFreeformFieldSpecification' => 'DifferentialFieldSpecification', 2971 2911 'DifferentialGitSVNIDField' => 'DifferentialCustomField', 2972 - 'DifferentialGitSVNIDFieldSpecification' => 'DifferentialFieldSpecification', 2973 2912 'DifferentialHostField' => 'DifferentialCustomField', 2974 - 'DifferentialHostFieldSpecification' => 'DifferentialFieldSpecification', 2975 2913 'DifferentialHovercardEventListener' => 'PhabricatorEventListener', 2976 2914 'DifferentialHunk' => 'DifferentialDAO', 2977 2915 'DifferentialHunkParserTestCase' => 'PhabricatorTestCase', ··· 2983 2921 'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery', 2984 2922 'DifferentialInlineCommentView' => 'AphrontView', 2985 2923 'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField', 2986 - 'DifferentialJIRAIssuesFieldSpecification' => 'DifferentialFieldSpecification', 2987 2924 'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener', 2988 2925 'DifferentialLandingToGitHub' => 'DifferentialLandingStrategy', 2989 2926 'DifferentialLandingToHostedGit' => 'DifferentialLandingStrategy', 2990 2927 'DifferentialLandingToHostedMercurial' => 'DifferentialLandingStrategy', 2991 - 'DifferentialLinesFieldSpecification' => 'DifferentialFieldSpecification', 2992 2928 'DifferentialLintField' => 'DifferentialCustomField', 2993 - 'DifferentialLintFieldSpecification' => 'DifferentialFieldSpecification', 2994 2929 'DifferentialLocalCommitsView' => 'AphrontView', 2995 2930 'DifferentialMail' => 'PhabricatorMail', 2996 2931 'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField', 2997 - 'DifferentialManiphestTasksFieldSpecification' => 'DifferentialFieldSpecification', 2998 2932 'DifferentialPHIDTypeDiff' => 'PhabricatorPHIDType', 2999 2933 'DifferentialPHIDTypeRevision' => 'PhabricatorPHIDType', 3000 2934 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 3001 2935 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase', 3002 2936 'DifferentialPathField' => 'DifferentialCustomField', 3003 - 'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification', 3004 2937 'DifferentialPrimaryPaneView' => 'AphrontView', 3005 2938 'DifferentialProjectReviewersField' => 'DifferentialCustomField', 3006 - 'DifferentialProjectReviewersFieldSpecification' => 'DifferentialFieldSpecification', 3007 - 'DifferentialReleephRequestFieldSpecification' => 'DifferentialFieldSpecification', 3008 2939 'DifferentialRemarkupRule' => 'PhabricatorRemarkupRuleObject', 3009 2940 'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler', 3010 2941 'DifferentialRepositoryField' => 'DifferentialCoreCustomField', 3011 - 'DifferentialRepositoryFieldSpecification' => 'DifferentialFieldSpecification', 3012 2942 'DifferentialRepositoryLookup' => 'Phobject', 3013 2943 'DifferentialResultsTableView' => 'AphrontView', 3014 2944 'DifferentialRevertPlanField' => 'DifferentialStoredCustomField', 3015 - 'DifferentialRevertPlanFieldSpecification' => 'DifferentialFieldSpecification', 3016 2945 'DifferentialReviewedByField' => 'DifferentialCoreCustomField', 3017 - 'DifferentialReviewedByFieldSpecification' => 'DifferentialFieldSpecification', 3018 2946 'DifferentialReviewersField' => 'DifferentialCoreCustomField', 3019 - 'DifferentialReviewersFieldSpecification' => 'DifferentialFieldSpecification', 3020 2947 'DifferentialReviewersView' => 'AphrontView', 3021 2948 'DifferentialRevision' => 3022 2949 array( ··· 3032 2959 'DifferentialRevisionDetailView' => 'AphrontView', 3033 2960 'DifferentialRevisionEditController' => 'DifferentialController', 3034 2961 'DifferentialRevisionIDField' => 'DifferentialCustomField', 3035 - 'DifferentialRevisionIDFieldParserTestCase' => 'PhabricatorTestCase', 3036 - 'DifferentialRevisionIDFieldSpecification' => 'DifferentialFieldSpecification', 3037 2962 'DifferentialRevisionLandController' => 'DifferentialController', 3038 2963 'DifferentialRevisionListController' => 3039 2964 array( ··· 3044 2969 'DifferentialRevisionMailReceiver' => 'PhabricatorObjectMailReceiver', 3045 2970 'DifferentialRevisionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 3046 2971 'DifferentialRevisionSearchEngine' => 'PhabricatorApplicationSearchEngine', 3047 - 'DifferentialRevisionStatusFieldSpecification' => 'DifferentialFieldSpecification', 3048 2972 'DifferentialRevisionUpdateHistoryView' => 'AphrontView', 3049 2973 'DifferentialRevisionViewController' => 'DifferentialController', 3050 2974 'DifferentialSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 3051 2975 'DifferentialStoredCustomField' => 'DifferentialCustomField', 3052 2976 'DifferentialSubscribersField' => 'DifferentialCoreCustomField', 3053 2977 'DifferentialSummaryField' => 'DifferentialCoreCustomField', 3054 - 'DifferentialSummaryFieldSpecification' => 'DifferentialFreeformFieldSpecification', 3055 2978 'DifferentialTestPlanField' => 'DifferentialCoreCustomField', 3056 - 'DifferentialTestPlanFieldSpecification' => 'DifferentialFieldSpecification', 3057 2979 'DifferentialTitleField' => 'DifferentialCoreCustomField', 3058 - 'DifferentialTitleFieldSpecification' => 'DifferentialFreeformFieldSpecification', 3059 2980 'DifferentialTransaction' => 'PhabricatorApplicationTransaction', 3060 2981 'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment', 3061 2982 'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 3062 2983 'DifferentialTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 3063 2984 'DifferentialTransactionView' => 'PhabricatorApplicationTransactionView', 3064 2985 'DifferentialUnitField' => 'DifferentialCustomField', 3065 - 'DifferentialUnitFieldSpecification' => 'DifferentialFieldSpecification', 3066 2986 'DifferentialViewPolicyField' => 'DifferentialCoreCustomField', 3067 - 'DifferentialViewPolicyFieldSpecification' => 'DifferentialFieldSpecification', 3068 2987 'DiffusionBranchTableController' => 'DiffusionController', 3069 2988 'DiffusionBranchTableView' => 'DiffusionView', 3070 2989 'DiffusionBrowseController' => 'DiffusionController',
+25 -2
src/applications/differential/customfield/DifferentialRevisionIDField.php
··· 34 34 } 35 35 36 36 public function parseValueFromCommitMessage($value) { 37 - return DifferentialRevisionIDFieldSpecification::parseRevisionIDFromURI( 38 - $value); 37 + return self::parseRevisionIDFromURI($value); 39 38 } 40 39 41 40 public function renderCommitMessageValue(array $handles) { 42 41 return PhabricatorEnv::getProductionURI('/D'.$this->getObject()->getID()); 42 + } 43 + 44 + private static function parseRevisionIDFromURI($uri) { 45 + $path = id(new PhutilURI($uri))->getPath(); 46 + 47 + $matches = null; 48 + if (preg_match('#^/D(\d+)$#', $path, $matches)) { 49 + $id = (int)$matches[1]; 50 + // Make sure the URI is the same as our URI. Basically, we want to ignore 51 + // commits from other Phabricator installs. 52 + if ($uri == PhabricatorEnv::getProductionURI('/D'.$id)) { 53 + return $id; 54 + } 55 + 56 + $allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id); 57 + 58 + foreach ($allowed_uris as $allowed_uri) { 59 + if ($uri == $allowed_uri) { 60 + return $id; 61 + } 62 + } 63 + } 64 + 65 + return null; 43 66 } 44 67 45 68 }
-14
src/applications/differential/field/exception/DifferentialFieldDataNotAvailableException.php
··· 1 - <?php 2 - 3 - final class DifferentialFieldDataNotAvailableException extends Exception { 4 - 5 - public function __construct(DifferentialFieldSpecification $spec) { 6 - $key = $spec->getStorageKey(); 7 - $class = get_class($spec); 8 - 9 - parent::__construct( 10 - "Differential field specification for '{$key}' (of class '{$class}') is ". 11 - "attempting to access data which is not available in this context."); 12 - } 13 - 14 - }
-16
src/applications/differential/field/exception/DifferentialFieldSpecificationIncompleteException.php
··· 1 - <?php 2 - 3 - final class DifferentialFieldSpecificationIncompleteException 4 - extends Exception { 5 - 6 - public function __construct(DifferentialFieldSpecification $spec) { 7 - $key = $spec->getStorageKey(); 8 - $class = get_class($spec); 9 - 10 - parent::__construct( 11 - "Differential field specification for '{$key}' (of class '{$class}') is ". 12 - "incompletely implemented: it claims it should appear in a context but ". 13 - "does not implement all the required methods for that context."); 14 - } 15 - 16 - }
-19
src/applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialApplyPatchFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForRevisionView() { 11 - return 'Apply Patch:'; 12 - } 13 - 14 - public function renderValueForRevisionView() { 15 - $revision = $this->getRevision(); 16 - return phutil_tag('tt', array(), 'arc patch D'.$revision->getID()); 17 - } 18 - 19 - }
-38
src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialArcanistProjectFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function getRequiredHandlePHIDs() { 11 - $arcanist_phid = $this->getArcanistProjectPHID(); 12 - if (!$arcanist_phid) { 13 - return array(); 14 - } 15 - 16 - return array($arcanist_phid); 17 - } 18 - 19 - public function renderLabelForRevisionView() { 20 - return 'Arcanist Project:'; 21 - } 22 - 23 - public function renderValueForRevisionView() { 24 - $arcanist_phid = $this->getArcanistProjectPHID(); 25 - if (!$arcanist_phid) { 26 - return null; 27 - } 28 - 29 - $handle = $this->getHandle($arcanist_phid); 30 - return $handle->getName(); 31 - } 32 - 33 - private function getArcanistProjectPHID() { 34 - $diff = $this->getDiff(); 35 - return $diff->getArcanistProjectPHID(); 36 - } 37 - 38 - }
-76
src/applications/differential/field/specification/DifferentialAsanaRepresentationFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialAsanaRepresentationFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return (bool)PhabricatorEnv::getEnvConfig('asana.workspace-id'); 8 - } 9 - 10 - public function renderLabelForRevisionView() { 11 - return pht('In Asana:'); 12 - } 13 - 14 - public function renderValueForRevisionView() { 15 - $viewer = $this->getUser(); 16 - $src_phid = $this->getRevision()->getPHID(); 17 - $edge_type = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANATASK; 18 - 19 - $query = id(new PhabricatorEdgeQuery()) 20 - ->withSourcePHIDs(array($src_phid)) 21 - ->withEdgeTypes(array($edge_type)) 22 - ->needEdgeData(true); 23 - 24 - $edges = $query->execute(); 25 - if (!$edges) { 26 - return null; 27 - } 28 - 29 - $edge = head($edges[$src_phid][$edge_type]); 30 - 31 - if (!empty($edge['data']['gone'])) { 32 - return phutil_tag( 33 - 'em', 34 - array(), 35 - pht('Asana Task Deleted')); 36 - } 37 - 38 - $ref = id(new DoorkeeperImportEngine()) 39 - ->setViewer($viewer) 40 - ->withPHIDs(array($edge['dst'])) 41 - ->needLocalOnly(true) 42 - ->executeOne(); 43 - 44 - if (!$ref) { 45 - return null; 46 - } 47 - 48 - $tag_id = celerity_generate_unique_node_id(); 49 - $xobj = $ref->getExternalObject(); 50 - $href = $xobj->getObjectURI(); 51 - 52 - Javelin::initBehavior( 53 - 'doorkeeper-tag', 54 - array( 55 - 'tags' => array( 56 - array( 57 - 'id' => $tag_id, 58 - 'ref' => array( 59 - $ref->getApplicationType(), 60 - $ref->getApplicationDomain(), 61 - $ref->getObjectType(), 62 - $ref->getObjectID(), 63 - ), 64 - ), 65 - ), 66 - )); 67 - 68 - return id(new PHUITagView()) 69 - ->setID($tag_id) 70 - ->setName($href) 71 - ->setHref($href) 72 - ->setType(PHUITagView::TYPE_OBJECT) 73 - ->setExternal(true); 74 - } 75 - 76 - }
-67
src/applications/differential/field/specification/DifferentialAuditorsFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialAuditorsFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $auditors = array(); 7 - 8 - public function shouldAppearOnCommitMessage() { 9 - return true; 10 - } 11 - 12 - public function shouldAppearOnCommitMessageTemplate() { 13 - return false; 14 - } 15 - 16 - public function getCommitMessageKey() { 17 - return 'auditorPHIDs'; 18 - } 19 - 20 - public function setValueFromParsedCommitMessage($value) { 21 - $this->auditors = nonempty($value, array()); 22 - return $this; 23 - } 24 - 25 - public function renderLabelForCommitMessage() { 26 - return 'Auditors'; 27 - } 28 - 29 - public function getRequiredHandlePHIDsForCommitMessage() { 30 - return $this->auditors; 31 - } 32 - 33 - public function renderValueForCommitMessage($is_edit) { 34 - if (!$this->auditors) { 35 - return null; 36 - } 37 - 38 - $names = array(); 39 - foreach ($this->auditors as $phid) { 40 - $names[] = $this->getHandle($phid)->getName(); 41 - } 42 - 43 - return implode(', ', $names); 44 - } 45 - 46 - public function parseValueFromCommitMessage($value) { 47 - return $this->parseCommitMessageUserList($value); 48 - } 49 - 50 - public function getStorageKey() { 51 - return 'phabricator:auditors'; 52 - } 53 - 54 - public function getValueForStorage() { 55 - return json_encode($this->auditors); 56 - } 57 - 58 - public function setValueFromStorage($value) { 59 - $auditors = json_decode($value, true); 60 - if (!is_array($auditors)) { 61 - $auditors = array(); 62 - } 63 - $this->auditors = $auditors; 64 - return $this; 65 - } 66 - 67 - }
-44
src/applications/differential/field/specification/DifferentialAuthorFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialAuthorFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function getRequiredHandlePHIDsForRevisionView() { 11 - return array($this->getAuthorPHID()); 12 - } 13 - 14 - public function renderLabelForRevisionView() { 15 - return 'Author:'; 16 - } 17 - 18 - public function renderValueForRevisionView() { 19 - return $this->renderUserList(array($this->getAuthorPHID())); 20 - } 21 - 22 - private function getAuthorPHID() { 23 - $revision = $this->getRevision(); 24 - return $revision->getAuthorPHID(); 25 - } 26 - 27 - public function shouldAppearOnRevisionList() { 28 - return true; 29 - } 30 - 31 - public function renderHeaderForRevisionList() { 32 - return 'Author'; 33 - } 34 - 35 - public function renderValueForRevisionList(DifferentialRevision $revision) { 36 - return $this->getHandle($revision->getAuthorPHID())->renderLink(); 37 - } 38 - 39 - public function getRequiredHandlePHIDsForRevisionList( 40 - DifferentialRevision $revision) { 41 - return array($revision->getAuthorPHID()); 42 - } 43 - 44 - }
-92
src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialBlameRevisionFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $value; 7 - 8 - public function getStorageKey() { 9 - return 'phabricator:blame-revision'; 10 - } 11 - 12 - public function getValueForStorage() { 13 - return $this->value; 14 - } 15 - 16 - public function setValueFromStorage($value) { 17 - $this->value = $value; 18 - return $this; 19 - } 20 - 21 - public function shouldAppearOnEdit() { 22 - return true; 23 - } 24 - 25 - public function setValueFromRequest(AphrontRequest $request) { 26 - $this->value = $request->getStr($this->getStorageKey()); 27 - return $this; 28 - } 29 - 30 - public function renderEditControl() { 31 - return id(new AphrontFormTextControl()) 32 - ->setLabel(pht('Blame Revision')) 33 - ->setCaption( 34 - pht('Revision which broke the stuff which this change fixes.')) 35 - ->setName($this->getStorageKey()) 36 - ->setValue($this->value); 37 - } 38 - 39 - public function shouldAppearOnRevisionView() { 40 - return true; 41 - } 42 - 43 - public function renderLabelForRevisionView() { 44 - return pht('Blame Revision:'); 45 - } 46 - 47 - public function renderValueForRevisionView() { 48 - if (!$this->value) { 49 - return null; 50 - } 51 - $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); 52 - $engine->setConfig('viewer', $this->getUser()); 53 - return $engine->markupText($this->value); 54 - } 55 - 56 - public function shouldAppearOnCommitMessage() { 57 - return true; 58 - } 59 - 60 - public function getCommitMessageKey() { 61 - return 'blameRevision'; 62 - } 63 - 64 - public function setValueFromParsedCommitMessage($value) { 65 - $this->value = $value; 66 - return $this; 67 - } 68 - 69 - public function shouldOverwriteWhenCommitMessageIsEdited() { 70 - return true; 71 - } 72 - 73 - public function renderLabelForCommitMessage() { 74 - return 'Blame Revision'; 75 - } 76 - 77 - public function renderValueForCommitMessage($is_edit) { 78 - return $this->value; 79 - } 80 - 81 - public function getSupportedCommitMessageLabels() { 82 - return array( 83 - 'Blame Revision', 84 - 'Blame Rev', 85 - ); 86 - } 87 - 88 - public function parseValueFromCommitMessage($value) { 89 - return $value; 90 - } 91 - 92 - }
-34
src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialBranchFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForRevisionView() { 11 - return 'Branch:'; 12 - } 13 - 14 - private function getBranchOrBookmarkDescription(DifferentialDiff $diff) { 15 - $branch = $diff->getBranch(); 16 - $bookmark = $diff->getBookmark(); 17 - $has_branch = ($branch != ''); 18 - $has_bookmark = ($bookmark != ''); 19 - if ($has_branch && $has_bookmark) { 20 - return "{$bookmark} bookmark on {$branch} branch"; 21 - } else if ($has_bookmark) { 22 - return "{$bookmark} bookmark"; 23 - } else if ($has_branch) { 24 - return $branch; 25 - } 26 - return null; 27 - } 28 - 29 - public function renderValueForRevisionView() { 30 - $diff = $this->getManualDiff(); 31 - return $this->getBranchOrBookmarkDescription($diff); 32 - } 33 - 34 - }
-106
src/applications/differential/field/specification/DifferentialCCsFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialCCsFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $ccs = array(); 7 - 8 - public function shouldAppearOnRevisionView() { 9 - return true; 10 - } 11 - 12 - public function getRequiredHandlePHIDsForRevisionView() { 13 - return $this->getCCPHIDs(); 14 - } 15 - 16 - public function renderLabelForRevisionView() { 17 - return 'CCs:'; 18 - } 19 - 20 - public function renderValueForRevisionView() { 21 - return $this->renderUserList($this->getCCPHIDs()); 22 - } 23 - 24 - private function getCCPHIDs() { 25 - $revision = $this->getRevision(); 26 - return $revision->getCCPHIDs(); 27 - } 28 - 29 - public function shouldAppearOnEdit() { 30 - return true; 31 - } 32 - 33 - protected function didSetRevision() { 34 - $this->ccs = $this->getCCPHIDs(); 35 - } 36 - 37 - public function getRequiredHandlePHIDsForRevisionEdit() { 38 - return $this->ccs; 39 - } 40 - 41 - public function getRequiredHandlePHIDsForCommitMessage() { 42 - return $this->ccs; 43 - } 44 - 45 - public function setValueFromRequest(AphrontRequest $request) { 46 - $this->ccs = $request->getArr('cc'); 47 - return $this; 48 - } 49 - 50 - public function renderEditControl() { 51 - $cc_map = array(); 52 - foreach ($this->ccs as $phid) { 53 - $cc_map[] = $this->getHandle($phid); 54 - } 55 - return id(new AphrontFormTokenizerControl()) 56 - ->setLabel('CC') 57 - ->setName('cc') 58 - ->setUser($this->getUser()) 59 - ->setDatasource('/typeahead/common/mailable/') 60 - ->setValue($cc_map); 61 - } 62 - 63 - public function shouldAppearOnCommitMessage() { 64 - return true; 65 - } 66 - 67 - public function getCommitMessageKey() { 68 - return 'ccPHIDs'; 69 - } 70 - 71 - public function setValueFromParsedCommitMessage($value) { 72 - $this->ccs = array_unique(nonempty($value, array())); 73 - return $this; 74 - } 75 - 76 - public function renderLabelForCommitMessage() { 77 - return 'CC'; 78 - } 79 - 80 - public function renderValueForCommitMessage($is_edit) { 81 - if (!$this->ccs) { 82 - return null; 83 - } 84 - 85 - $names = array(); 86 - foreach ($this->ccs as $phid) { 87 - $handle = $this->getHandle($phid); 88 - if ($handle->isComplete()) { 89 - $names[] = $handle->getObjectName(); 90 - } 91 - } 92 - return implode(', ', $names); 93 - } 94 - 95 - public function getSupportedCommitMessageLabels() { 96 - return array( 97 - 'CC', 98 - 'CCs', 99 - ); 100 - } 101 - 102 - public function parseValueFromCommitMessage($value) { 103 - return $this->parseCommitMessageMailableList($value); 104 - } 105 - 106 - }
-37
src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialCommitsFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function getRequiredHandlePHIDsForRevisionView() { 11 - return $this->getCommitPHIDs(); 12 - } 13 - 14 - public function renderLabelForRevisionView() { 15 - return 'Commits:'; 16 - } 17 - 18 - public function renderValueForRevisionView() { 19 - $commit_phids = $this->getCommitPHIDs(); 20 - if (!$commit_phids) { 21 - return null; 22 - } 23 - 24 - $links = array(); 25 - foreach ($commit_phids as $commit_phid) { 26 - $links[] = $this->getHandle($commit_phid)->renderLink(); 27 - } 28 - 29 - return phutil_implode_html(phutil_tag('br'), $links); 30 - } 31 - 32 - private function getCommitPHIDs() { 33 - $revision = $this->getRevision(); 34 - return $revision->getCommitPHIDs(); 35 - } 36 - 37 - }
-34
src/applications/differential/field/specification/DifferentialConflictsFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialConflictsFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnCommitMessage() { 7 - return true; 8 - } 9 - 10 - public function shouldAppearOnCommitMessageTemplate() { 11 - return false; 12 - } 13 - 14 - public function getCommitMessageKey() { 15 - return 'conflicts'; 16 - } 17 - 18 - public function setValueFromParsedCommitMessage($value) { 19 - return $this; 20 - } 21 - 22 - public function renderLabelForCommitMessage() { 23 - return 'Conflicts'; 24 - } 25 - 26 - public function renderValueForCommitMessage($is_edit) { 27 - return null; 28 - } 29 - 30 - public function parseValueFromCommitMessage($value) { 31 - return $value; 32 - } 33 - 34 - }
-18
src/applications/differential/field/specification/DifferentialDateCreatedFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialDateCreatedFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionList() { 7 - return true; 8 - } 9 - 10 - public function renderHeaderForRevisionList() { 11 - return 'Created'; 12 - } 13 - 14 - public function renderValueForRevisionList(DifferentialRevision $revision) { 15 - return phabricator_date($revision->getDateCreated(), $this->getUser()); 16 - } 17 - 18 - }
-18
src/applications/differential/field/specification/DifferentialDateModifiedFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialDateModifiedFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionList() { 7 - return true; 8 - } 9 - 10 - public function renderHeaderForRevisionList() { 11 - return 'Updated'; 12 - } 13 - 14 - public function renderValueForRevisionList(DifferentialRevision $revision) { 15 - return phabricator_datetime($revision->getDateModified(), $this->getUser()); 16 - } 17 - 18 - }
-38
src/applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialDependenciesFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function getRequiredHandlePHIDsForRevisionView() { 11 - return $this->getDependentRevisionPHIDs(); 12 - } 13 - 14 - public function renderLabelForRevisionView() { 15 - return 'Dependents:'; 16 - } 17 - 18 - public function renderValueForRevisionView() { 19 - $revision_phids = $this->getDependentRevisionPHIDs(); 20 - if (!$revision_phids) { 21 - return null; 22 - } 23 - 24 - $links = array(); 25 - foreach ($revision_phids as $revision_phids) { 26 - $links[] = $this->getHandle($revision_phids)->renderLink(); 27 - } 28 - 29 - return phutil_implode_html(phutil_tag('br'), $links); 30 - } 31 - 32 - private function getDependentRevisionPHIDs() { 33 - return PhabricatorEdgeQuery::loadDestinationPHIDs( 34 - $this->getRevision()->getPHID(), 35 - PhabricatorEdgeConfig::TYPE_DREV_DEPENDED_ON_BY_DREV); 36 - } 37 - 38 - }
-38
src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialDependsOnFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function getRequiredHandlePHIDsForRevisionView() { 11 - return $this->getDependentRevisionPHIDs(); 12 - } 13 - 14 - public function renderLabelForRevisionView() { 15 - return 'Depends On:'; 16 - } 17 - 18 - public function renderValueForRevisionView() { 19 - $revision_phids = $this->getDependentRevisionPHIDs(); 20 - if (!$revision_phids) { 21 - return null; 22 - } 23 - 24 - $links = array(); 25 - foreach ($revision_phids as $revision_phid) { 26 - $links[] = $this->getHandle($revision_phid)->renderLink(); 27 - } 28 - 29 - return phutil_implode_html(phutil_tag('br'), $links); 30 - } 31 - 32 - private function getDependentRevisionPHIDs() { 33 - return PhabricatorEdgeQuery::loadDestinationPHIDs( 34 - $this->getRevision()->getPHID(), 35 - PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV); 36 - } 37 - 38 - }
-25
src/applications/differential/field/specification/DifferentialDiffViewPolicyFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialDiffViewPolicyFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnDiffView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForDiffView() { 11 - return pht('Visible To'); 12 - } 13 - 14 - public function renderValueForDiffView() { 15 - $user = $this->getUser(); 16 - $diff = $this->getDiff(); 17 - 18 - $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( 19 - $user, 20 - $diff); 21 - 22 - return idx($descriptions, PhabricatorPolicyCapability::CAN_VIEW); 23 - } 24 - 25 - }
-38
src/applications/differential/field/specification/DifferentialEditPolicyFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialEditPolicyFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $value; 7 - 8 - public function shouldAppearOnEdit() { 9 - return true; 10 - } 11 - 12 - protected function didSetRevision() { 13 - $this->value = $this->getRevision()->getEditPolicy(); 14 - } 15 - 16 - public function setValueFromRequest(AphrontRequest $request) { 17 - $this->value = $request->getStr('editPolicy'); 18 - return $this; 19 - } 20 - 21 - public function renderEditControl() { 22 - $viewer = $this->getUser(); 23 - $revision = $this->getRevision(); 24 - 25 - $policies = id(new PhabricatorPolicyQuery()) 26 - ->setViewer($viewer) 27 - ->setObject($revision) 28 - ->execute(); 29 - 30 - return id(new AphrontFormPolicyControl()) 31 - ->setUser($viewer) 32 - ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 33 - ->setPolicyObject($revision) 34 - ->setPolicies($policies) 35 - ->setName('editPolicy'); 36 - } 37 - 38 - }
-22
src/applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialExportPatchFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForRevisionView() { 11 - return 'Export Patch:'; 12 - } 13 - 14 - public function renderValueForRevisionView() { 15 - $revision = $this->getRevision(); 16 - return phutil_tag( 17 - 'tt', 18 - array(), 19 - 'arc export --revision '.$revision->getID()); 20 - } 21 - 22 - }
-903
src/applications/differential/field/specification/DifferentialFieldSpecification.php
··· 1 - <?php 2 - 3 - /** 4 - * Describes and implements the behavior for a custom field on Differential 5 - * revisions. Along with other configuration, you can extend this class to add 6 - * custom fields to Differential revisions and commit messages. 7 - * 8 - * Generally, you should implement all methods from the storage task and then 9 - * the methods from one or more interface tasks. 10 - * 11 - * @task storage Field Storage 12 - * @task edit Extending the Revision Edit Interface 13 - * @task view Extending the Revision View Interface 14 - * @task list Extending the Revision List Interface 15 - * @task mail Extending the E-mail Interface 16 - * @task commit Extending Commit Messages 17 - * @task load Loading Additional Data 18 - * @task context Contextual Data 19 - */ 20 - abstract class DifferentialFieldSpecification { 21 - 22 - private $revision; 23 - private $diff; 24 - private $manualDiff; 25 - private $handles; 26 - private $diffProperties; 27 - private $user; 28 - 29 - 30 - /* -( Storage )------------------------------------------------------------ */ 31 - 32 - 33 - /** 34 - * Return a unique string used to key storage of this field's value, like 35 - * "mycompany.fieldname" or similar. You can return null (the default) to 36 - * indicate that this field does not use any storage. This is appropriate for 37 - * display fields, like @{class:DifferentialLinesFieldSpecification}. If you 38 - * implement this, you must also implement @{method:getValueForStorage} and 39 - * @{method:setValueFromStorage}. 40 - * 41 - * @return string|null Unique key which identifies this field in auxiliary 42 - * field storage. Maximum length is 32. Alternatively, 43 - * null (default) to indicate that this field does not 44 - * use auxiliary field storage. 45 - * @task storage 46 - */ 47 - public function getStorageKey() { 48 - return null; 49 - } 50 - 51 - 52 - /** 53 - * Return a serialized representation of the field value, appropriate for 54 - * storing in auxiliary field storage. You must implement this method if 55 - * you implement @{method:getStorageKey}. 56 - * 57 - * @return string Serialized field value. 58 - * @task storage 59 - */ 60 - public function getValueForStorage() { 61 - throw new DifferentialFieldSpecificationIncompleteException($this); 62 - } 63 - 64 - 65 - /** 66 - * Set the field's value given a serialized storage value. This is called 67 - * when the field is loaded; if no data is available, the value will be 68 - * null. You must implement this method if you implement 69 - * @{method:getStorageKey}. 70 - * 71 - * @param string|null Serialized field representation (from 72 - * @{method:getValueForStorage}) or null if no value has 73 - * ever been stored. 74 - * @return this 75 - * @task storage 76 - */ 77 - public function setValueFromStorage($value) { 78 - throw new DifferentialFieldSpecificationIncompleteException($this); 79 - } 80 - 81 - 82 - /* -( Extending the Revision Edit Interface )------------------------------ */ 83 - 84 - 85 - /** 86 - * Determine if this field should appear on the "Edit Revision" interface. If 87 - * you return true from this method, you must implement 88 - * @{method:setValueFromRequest}, @{method:renderEditControl} and 89 - * @{method:validateField}. 90 - * 91 - * For a concrete example of a field which implements an edit interface, see 92 - * @{class:DifferentialRevertPlanFieldSpecification}. 93 - * 94 - * @return bool True to indicate that this field implements an edit interface. 95 - * @task edit 96 - */ 97 - public function shouldAppearOnEdit() { 98 - return false; 99 - } 100 - 101 - 102 - /** 103 - * Set the field's value from an HTTP request. Generally, you should read 104 - * the value of some field name you emitted in @{method:renderEditControl} 105 - * and save it into the object, e.g.: 106 - * 107 - * $this->value = $request->getStr('my-custom-field'); 108 - * 109 - * If you have some particularly complicated field, you may need to read 110 - * more data; this is why you have access to the entire request. 111 - * 112 - * You must implement this if you implement @{method:shouldAppearOnEdit}. 113 - * 114 - * You should not perform field validation here; instead, you should implement 115 - * @{method:validateField}. 116 - * 117 - * @param AphrontRequest HTTP request representing a user submitting a form 118 - * with this field in it. 119 - * @return this 120 - * @task edit 121 - */ 122 - public function setValueFromRequest(AphrontRequest $request) { 123 - throw new DifferentialFieldSpecificationIncompleteException($this); 124 - } 125 - 126 - 127 - /** 128 - * Build a renderable object (generally, some @{class:AphrontFormControl}) 129 - * which can be appended to a @{class:AphrontFormView} and represents the 130 - * interface the user sees on the "Edit Revision" screen when interacting 131 - * with this field. 132 - * 133 - * For example: 134 - * 135 - * return id(new AphrontFormTextControl()) 136 - * ->setLabel('Custom Field') 137 - * ->setName('my-custom-key') 138 - * ->setValue($this->value); 139 - * 140 - * You must implement this if you implement @{method:shouldAppearOnEdit}. 141 - * 142 - * @return AphrontView|string Something renderable. 143 - * @task edit 144 - */ 145 - public function renderEditControl() { 146 - throw new DifferentialFieldSpecificationIncompleteException($this); 147 - } 148 - 149 - 150 - /** 151 - * Optionally, build a preview panel for the field which will appear on the 152 - * edit interface. This is used for the "Summary" field, but custom fields 153 - * generally need not implement it. 154 - * 155 - * @return AphrontView|string Something renderable. 156 - * @task edit 157 - */ 158 - public function renderEditPreview() { 159 - return null; 160 - } 161 - 162 - 163 - /** 164 - * This method will be called after @{method:setValueFromRequest} but before 165 - * the field is saved. It gives you an opportunity to inspect the field value 166 - * and throw a @{class:DifferentialFieldValidationException} if there is a 167 - * problem with the value the user has provided (for example, the value the 168 - * user entered is not correctly formatted). This method is also called after 169 - * @{method:setValueFromParsedCommitMessage} before the revision is saved. 170 - * 171 - * By default, fields are not validated. 172 - * 173 - * @return void 174 - * @task edit 175 - */ 176 - public function validateField() { 177 - return; 178 - } 179 - 180 - /** 181 - * Determine if user mentions should be extracted from the value and added to 182 - * CC when creating revision. Mentions are then extracted from the string 183 - * returned by @{method:renderValueForCommitMessage}. 184 - * 185 - * By default, mentions are not extracted. 186 - * 187 - * @return bool 188 - * @task edit 189 - */ 190 - public function shouldExtractMentions() { 191 - return false; 192 - } 193 - 194 - 195 - /* -( Extending the Revision View Interface )------------------------------ */ 196 - 197 - 198 - /** 199 - * Determine if this field should appear on the revision detail view 200 - * interface. One use of this interface is to add purely informational 201 - * fields to the revision view, without any sort of backing storage. 202 - * 203 - * If you return true from this method, you must implement the methods 204 - * @{method:renderLabelForRevisionView} and 205 - * @{method:renderValueForRevisionView}. 206 - * 207 - * @return bool True if this field should appear when viewing a revision. 208 - * @task view 209 - */ 210 - public function shouldAppearOnRevisionView() { 211 - return false; 212 - } 213 - 214 - 215 - /** 216 - * Return a string field label which will appear in the revision detail 217 - * table. 218 - * 219 - * You must implement this method if you return true from 220 - * @{method:shouldAppearOnRevisionView}. 221 - * 222 - * @return string Label for field in revision detail view. 223 - * @task view 224 - */ 225 - public function renderLabelForRevisionView() { 226 - throw new DifferentialFieldSpecificationIncompleteException($this); 227 - } 228 - 229 - 230 - /** 231 - * Return a markup block representing the field for the revision detail 232 - * view. Note that you can return null to suppress display (for instance, 233 - * if the field shows related objects of some type and the revision doesn't 234 - * have any related objects). 235 - * 236 - * You must implement this method if you return true from 237 - * @{method:shouldAppearOnRevisionView}. 238 - * 239 - * @return string|null Display markup for field value, or null to suppress 240 - * field rendering. 241 - * @task view 242 - */ 243 - public function renderValueForRevisionView() { 244 - throw new DifferentialFieldSpecificationIncompleteException($this); 245 - } 246 - 247 - 248 - /** 249 - * Load users, their current statuses and return a markup with links to the 250 - * user profiles and information about their current status. 251 - * 252 - * @return string Display markup. 253 - * @task view 254 - */ 255 - public function renderUserList(array $user_phids) { 256 - if (!$user_phids) { 257 - return phutil_tag('em', array(), pht('None')); 258 - } 259 - 260 - return implode_selected_handle_links(', ', 261 - $this->getLoadedHandles(), $user_phids); 262 - } 263 - 264 - 265 - /** 266 - * Return a markup block representing a warning to display with the comment 267 - * box when preparing to accept a diff. A return value of null indicates no 268 - * warning box should be displayed for this field. 269 - * 270 - * @return string|null Display markup for warning box, or null for no warning 271 - */ 272 - public function renderWarningBoxForRevisionAccept() { 273 - return null; 274 - } 275 - 276 - 277 - /* -( Extending the Revision List Interface )------------------------------ */ 278 - 279 - 280 - /** 281 - * Determine if this field should appear in the table on the revision list 282 - * interface. 283 - * 284 - * @return bool True if this field should appear in the table. 285 - * 286 - * @task list 287 - */ 288 - public function shouldAppearOnRevisionList() { 289 - return false; 290 - } 291 - 292 - 293 - /** 294 - * Return a column header for revision list tables. 295 - * 296 - * @return string Column header. 297 - * 298 - * @task list 299 - */ 300 - public function renderHeaderForRevisionList() { 301 - throw new DifferentialFieldSpecificationIncompleteException($this); 302 - } 303 - 304 - 305 - /** 306 - * Optionally, return a column class for revision list tables. 307 - * 308 - * @return string CSS class for table cells. 309 - * 310 - * @task list 311 - */ 312 - public function getColumnClassForRevisionList() { 313 - return null; 314 - } 315 - 316 - 317 - /** 318 - * Return a table cell value for revision list tables. 319 - * 320 - * @param DifferentialRevision The revision to render a value for. 321 - * @return string Table cell value. 322 - * 323 - * @task list 324 - */ 325 - public function renderValueForRevisionList(DifferentialRevision $revision) { 326 - throw new DifferentialFieldSpecificationIncompleteException($this); 327 - } 328 - 329 - 330 - /* -( Extending the Diff View Interface )------------------------------ */ 331 - 332 - 333 - /** 334 - * Determine if this field should appear on the diff detail view 335 - * interface. One use of this interface is to add purely informational 336 - * fields to the diff view, without any sort of backing storage. 337 - * 338 - * NOTE: These diffs are not necessarily attached yet to a revision. 339 - * As such, a field on the diff view can not rely on the existence of a 340 - * revision or use storage attached to the revision. 341 - * 342 - * If you return true from this method, you must implement the methods 343 - * @{method:renderLabelForDiffView} and 344 - * @{method:renderValueForDiffView}. 345 - * 346 - * @return bool True if this field should appear when viewing a diff. 347 - * @task view 348 - */ 349 - public function shouldAppearOnDiffView() { 350 - return false; 351 - } 352 - 353 - 354 - /** 355 - * Return a string field label which will appear in the diff detail 356 - * table. 357 - * 358 - * You must implement this method if you return true from 359 - * @{method:shouldAppearOnDiffView}. 360 - * 361 - * @return string Label for field in revision detail view. 362 - * @task view 363 - */ 364 - public function renderLabelForDiffView() { 365 - throw new DifferentialFieldSpecificationIncompleteException($this); 366 - } 367 - 368 - 369 - /** 370 - * Return a markup block representing the field for the diff detail 371 - * view. Note that you can return null to suppress display (for instance, 372 - * if the field shows related objects of some type and the revision doesn't 373 - * have any related objects). 374 - * 375 - * You must implement this method if you return true from 376 - * @{method:shouldAppearOnDiffView}. 377 - * 378 - * @return string|null Display markup for field value, or null to suppress 379 - * field rendering. 380 - * @task view 381 - */ 382 - public function renderValueForDiffView() { 383 - throw new DifferentialFieldSpecificationIncompleteException($this); 384 - } 385 - 386 - /* -( Extending the Search Interface )------------------------------------ */ 387 - 388 - /** 389 - * @task search 390 - */ 391 - public function shouldAddToSearchIndex() { 392 - return false; 393 - } 394 - 395 - /** 396 - * @task search 397 - */ 398 - public function getValueForSearchIndex() { 399 - throw new DifferentialFieldSpecificationIncompleteException($this); 400 - } 401 - 402 - /** 403 - * NOTE: Keys *must be* 4 characters for 404 - * @{class:PhabricatorSearchEngineMySQL}. 405 - * 406 - * @task search 407 - */ 408 - public function getKeyForSearchIndex() { 409 - throw new DifferentialFieldSpecificationIncompleteException($this); 410 - } 411 - 412 - /* -( Extending Commit Messages )------------------------------------------ */ 413 - 414 - 415 - /** 416 - * Determine if this field should appear in commit messages. You should return 417 - * true if this field participates in any part of the commit message workflow, 418 - * even if it is not rendered by default. 419 - * 420 - * If you implement this method, you must implement 421 - * @{method:getCommitMessageKey} and 422 - * @{method:setValueFromParsedCommitMessage}. 423 - * 424 - * @return bool True if this field appears in commit messages in any capacity. 425 - * @task commit 426 - */ 427 - public function shouldAppearOnCommitMessage() { 428 - return false; 429 - } 430 - 431 - /** 432 - * Key which identifies this field in parsed commit messages. Commit messages 433 - * exist in two forms: raw textual commit messages and parsed dictionaries of 434 - * fields. This method must return a unique string which identifies this field 435 - * in dictionaries. Principally, this dictionary is shipped to and from arc 436 - * over Conduit. Keys should be appropriate property names, like "testPlan" 437 - * (not "Test Plan") and must be globally unique. 438 - * 439 - * You must implement this method if you return true from 440 - * @{method:shouldAppearOnCommitMessage}. 441 - * 442 - * @return string Key which identifies the field in dictionaries. 443 - * @task commit 444 - */ 445 - public function getCommitMessageKey() { 446 - throw new DifferentialFieldSpecificationIncompleteException($this); 447 - } 448 - 449 - /** 450 - * Set this field's value from a value in a parsed commit message dictionary. 451 - * Afterward, this field will go through the normal write workflows and the 452 - * change will be permanently stored via either the storage mechanisms (if 453 - * your field implements them), revision write hooks (if your field implements 454 - * them) or discarded (if your field implements neither, e.g. is just a 455 - * display field). 456 - * 457 - * The value you receive will either be null or something you originally 458 - * returned from @{method:parseValueFromCommitMessage}. 459 - * 460 - * You must implement this method if you return true from 461 - * @{method:shouldAppearOnCommitMessage}. 462 - * 463 - * @param mixed Field value from a parsed commit message dictionary. 464 - * @return this 465 - * @task commit 466 - */ 467 - public function setValueFromParsedCommitMessage($value) { 468 - throw new DifferentialFieldSpecificationIncompleteException($this); 469 - } 470 - 471 - /** 472 - * In revision control systems which read revision information from the 473 - * working copy, the user may edit the commit message outside of invoking 474 - * "arc diff --edit". When they do this, only some fields (those fields which 475 - * can not be edited by other users) are safe to overwrite. For instance, it 476 - * is fine to overwrite "Summary" because no one else can edit it, but not 477 - * to overwrite "Reviewers" because reviewers may have been added or removed 478 - * via the web interface. 479 - * 480 - * If a field is safe to overwrite when edited in a working copy commit 481 - * message, return true. If the authoritative value should always be used, 482 - * return false. By default, fields can not be overwritten. 483 - * 484 - * arc will only attempt to overwrite field values if run with "--verbatim". 485 - * 486 - * @return bool True to indicate the field is save to overwrite. 487 - * @task commit 488 - */ 489 - public function shouldOverwriteWhenCommitMessageIsEdited() { 490 - return false; 491 - } 492 - 493 - /** 494 - * Return true if this field should be suggested to the user during 495 - * "arc diff --edit". Basicially, return true if the field is something the 496 - * user might want to fill out (like "Summary"), and false if it's a 497 - * system/display/readonly field (like "Differential Revision"). If this 498 - * method returns true, the field will be rendered even if it has no value 499 - * during edit and update operations. 500 - * 501 - * @return bool True to indicate the field should appear in the edit template. 502 - * @task commit 503 - */ 504 - public function shouldAppearOnCommitMessageTemplate() { 505 - return true; 506 - } 507 - 508 - /** 509 - * Render a human-readable label for this field, like "Summary" or 510 - * "Test Plan". This is distinct from the commit message key, but generally 511 - * they should be similar. 512 - * 513 - * @return string Human-readable field label for commit messages. 514 - * @task commit 515 - */ 516 - public function renderLabelForCommitMessage() { 517 - throw new DifferentialFieldSpecificationIncompleteException($this); 518 - } 519 - 520 - /** 521 - * Render a human-readable value for this field when it appears in commit 522 - * messages (for instance, lists of users should be rendered as user names). 523 - * 524 - * The ##$is_edit## parameter allows you to distinguish between commit 525 - * messages being rendered for editing and those being rendered for amending 526 - * or commit. Some fields may decline to render a value in one mode (for 527 - * example, "Reviewed By" appears only when doing commit/amend, not while 528 - * editing). 529 - * 530 - * @param bool True if the message is being edited. 531 - * @return string Human-readable field value. 532 - * @task commit 533 - */ 534 - public function renderValueForCommitMessage($is_edit) { 535 - throw new DifferentialFieldSpecificationIncompleteException($this); 536 - } 537 - 538 - /** 539 - * Return one or more labels which this field parses in commit messages. For 540 - * example, you might parse all of "Task", "Tasks" and "Task Numbers" or 541 - * similar. This is just to make it easier to get commit messages to parse 542 - * when users are typing in the fields manually as opposed to using a 543 - * template, by accepting alternate spellings / pluralizations / etc. By 544 - * default, only the label returned from @{method:renderLabelForCommitMessage} 545 - * is parsed. 546 - * 547 - * @return list List of supported labels that this field can parse from commit 548 - * messages. 549 - * @task commit 550 - */ 551 - public function getSupportedCommitMessageLabels() { 552 - return array($this->renderLabelForCommitMessage()); 553 - } 554 - 555 - /** 556 - * Parse a raw text block from a commit message into a canonical 557 - * representation of the field value. For example, the "CC" field accepts a 558 - * comma-delimited list of usernames and emails and parses them into valid 559 - * PHIDs, emitting a PHID list. 560 - * 561 - * If you encounter errors (like a nonexistent username) while parsing, 562 - * you should throw a @{class:DifferentialFieldParseException}. 563 - * 564 - * Generally, this method should accept whatever you return from 565 - * @{method:renderValueForCommitMessage} and parse it back into a sensible 566 - * representation. 567 - * 568 - * You must implement this method if you return true from 569 - * @{method:shouldAppearOnCommitMessage}. 570 - * 571 - * @param string 572 - * @return mixed The canonical representation of the field value. For example, 573 - * you should lookup usernames and object references. 574 - * @task commit 575 - */ 576 - public function parseValueFromCommitMessage($value) { 577 - throw new DifferentialFieldSpecificationIncompleteException($this); 578 - } 579 - 580 - 581 - 582 - /* -( Loading Additional Data )-------------------------------------------- */ 583 - 584 - 585 - /** 586 - * Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your 587 - * field to render correctly. 588 - * 589 - * This is a convenience method which makes the handles available on all 590 - * interfaces where the field appears. If your field needs handles on only 591 - * some interfaces (or needs different handles on different interfaces) you 592 - * can overload the more specific methods to customize which interfaces you 593 - * retrieve handles for. Requesting only the handles you need will improve 594 - * the performance of your field. 595 - * 596 - * You can later retrieve these handles by calling @{method:getHandle}. 597 - * 598 - * @return list List of PHIDs to load handles for. 599 - * @task load 600 - */ 601 - protected function getRequiredHandlePHIDs() { 602 - return array(); 603 - } 604 - 605 - 606 - /** 607 - * Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your 608 - * field to render correctly on the view interface. 609 - * 610 - * This is a more specific version of @{method:getRequiredHandlePHIDs} which 611 - * can be overridden to improve field performance by loading only data you 612 - * need. 613 - * 614 - * @return list List of PHIDs to load handles for. 615 - * @task load 616 - */ 617 - public function getRequiredHandlePHIDsForRevisionView() { 618 - return $this->getRequiredHandlePHIDs(); 619 - } 620 - 621 - 622 - /** 623 - * Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your 624 - * field to render correctly on the list interface. 625 - * 626 - * This is a more specific version of @{method:getRequiredHandlePHIDs} which 627 - * can be overridden to improve field performance by loading only data you 628 - * need. 629 - * 630 - * @param DifferentialRevision The revision to pull PHIDs for. 631 - * @return list List of PHIDs to load handles for. 632 - * @task load 633 - */ 634 - public function getRequiredHandlePHIDsForRevisionList( 635 - DifferentialRevision $revision) { 636 - return array(); 637 - } 638 - 639 - 640 - /** 641 - * Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your 642 - * field to render correctly on the edit interface. 643 - * 644 - * This is a more specific version of @{method:getRequiredHandlePHIDs} which 645 - * can be overridden to improve field performance by loading only data you 646 - * need. 647 - * 648 - * @return list List of PHIDs to load handles for. 649 - * @task load 650 - */ 651 - public function getRequiredHandlePHIDsForRevisionEdit() { 652 - return $this->getRequiredHandlePHIDs(); 653 - } 654 - 655 - /** 656 - * Specify which @{class:PhabricatorObjectHandle}s need to be loaded for your 657 - * field to render correctly on the commit message interface. 658 - * 659 - * This is a more specific version of @{method:getRequiredHandlePHIDs} which 660 - * can be overridden to improve field performance by loading only data you 661 - * need. 662 - * 663 - * @return list List of PHIDs to load handles for. 664 - * @task load 665 - */ 666 - public function getRequiredHandlePHIDsForCommitMessage() { 667 - return $this->getRequiredHandlePHIDs(); 668 - } 669 - 670 - /** 671 - * Parse a list of users into a canonical PHID list. 672 - * 673 - * @param string Raw list of comma-separated user names. 674 - * @return list List of corresponding PHIDs. 675 - * @task load 676 - */ 677 - protected function parseCommitMessageUserList($value) { 678 - return $this->parseCommitMessageObjectList($value, $mailables = false); 679 - } 680 - 681 - protected function parseCommitMessageUserOrProjectList($value) { 682 - return $this->parseCommitMessageObjectList( 683 - $value, 684 - $mailables = false, 685 - $allow_partial = false); 686 - } 687 - 688 - /** 689 - * Parse a list of mailable objects into a canonical PHID list. 690 - * 691 - * @param string Raw list of comma-separated mailable names. 692 - * @return list List of corresponding PHIDs. 693 - * @task load 694 - */ 695 - protected function parseCommitMessageMailableList($value) { 696 - return $this->parseCommitMessageObjectList($value, $mailables = true); 697 - } 698 - 699 - 700 - /** 701 - * Parse and lookup a list of object names, converting them to PHIDs. 702 - * 703 - * @param string Raw list of comma-separated object names. 704 - * @param bool True to include mailing lists. 705 - * @param bool True to make a best effort. By default, an exception is 706 - * thrown if any item is invalid. 707 - * @return list List of corresponding PHIDs. 708 - * @task load 709 - */ 710 - public static function parseCommitMessageObjectList( 711 - $value, 712 - $include_mailables, 713 - $allow_partial = false) { 714 - 715 - $types = array( 716 - PhabricatorPeoplePHIDTypeUser::TYPECONST, 717 - PhabricatorProjectPHIDTypeProject::TYPECONST, 718 - ); 719 - 720 - if ($include_mailables) { 721 - $types[] = PhabricatorMailingListPHIDTypeList::TYPECONST; 722 - } 723 - 724 - return id(new PhabricatorObjectListQuery()) 725 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 726 - ->setAllowPartialResults($allow_partial) 727 - ->setAllowedTypes($types) 728 - ->setObjectList($value) 729 - ->execute(); 730 - } 731 - 732 - 733 - /* -( Contextual Data )---------------------------------------------------- */ 734 - 735 - 736 - /** 737 - * @task context 738 - */ 739 - final public function setRevision(DifferentialRevision $revision) { 740 - $this->revision = $revision; 741 - $this->didSetRevision(); 742 - return $this; 743 - } 744 - 745 - /** 746 - * @task context 747 - */ 748 - protected function didSetRevision() { 749 - return; 750 - } 751 - 752 - 753 - /** 754 - * @task context 755 - */ 756 - final public function setDiff(DifferentialDiff $diff) { 757 - $this->diff = $diff; 758 - return $this; 759 - } 760 - 761 - /** 762 - * @task context 763 - */ 764 - final public function setManualDiff(DifferentialDiff $diff) { 765 - $this->manualDiff = $diff; 766 - return $this; 767 - } 768 - 769 - /** 770 - * @task context 771 - */ 772 - final public function setHandles(array $handles) { 773 - assert_instances_of($handles, 'PhabricatorObjectHandle'); 774 - $this->handles = $handles; 775 - return $this; 776 - } 777 - 778 - /** 779 - * @task context 780 - */ 781 - final public function setDiffProperties(array $diff_properties) { 782 - $this->diffProperties = $diff_properties; 783 - return $this; 784 - } 785 - 786 - /** 787 - * @task context 788 - */ 789 - final public function setUser(PhabricatorUser $user) { 790 - $this->user = $user; 791 - return $this; 792 - } 793 - 794 - /** 795 - * @task context 796 - */ 797 - final protected function getRevision() { 798 - if (empty($this->revision)) { 799 - throw new DifferentialFieldDataNotAvailableException($this); 800 - } 801 - return $this->revision; 802 - } 803 - 804 - 805 - /** 806 - * Determine if revision context is currently available. 807 - * 808 - * @task context 809 - */ 810 - final protected function hasRevision() { 811 - return (bool)$this->revision; 812 - } 813 - 814 - 815 - /** 816 - * @task context 817 - */ 818 - final protected function getDiff() { 819 - if (empty($this->diff)) { 820 - throw new DifferentialFieldDataNotAvailableException($this); 821 - } 822 - return $this->diff; 823 - } 824 - 825 - /** 826 - * @task context 827 - */ 828 - final protected function getManualDiff() { 829 - if (!$this->manualDiff) { 830 - return $this->getDiff(); 831 - } 832 - return $this->manualDiff; 833 - } 834 - 835 - /** 836 - * @task context 837 - */ 838 - final protected function getUser() { 839 - if (empty($this->user)) { 840 - throw new DifferentialFieldDataNotAvailableException($this); 841 - } 842 - return $this->user; 843 - } 844 - 845 - /** 846 - * Get the handle for an object PHID. You must overload 847 - * @{method:getRequiredHandlePHIDs} (or a more specific version thereof) 848 - * and include the PHID you want in the list for it to be available here. 849 - * 850 - * @return PhabricatorObjectHandle Handle to the object. 851 - * @task context 852 - */ 853 - final protected function getHandle($phid) { 854 - if ($this->handles === null) { 855 - throw new DifferentialFieldDataNotAvailableException($this); 856 - } 857 - if (empty($this->handles[$phid])) { 858 - $class = get_class($this); 859 - throw new Exception( 860 - "A differential field (of class '{$class}') is attempting to retrieve ". 861 - "a handle ('{$phid}') which it did not request. Return all handle ". 862 - "PHIDs you need from getRequiredHandlePHIDs()."); 863 - } 864 - return $this->handles[$phid]; 865 - } 866 - 867 - final protected function getLoadedHandles() { 868 - if ($this->handles === null) { 869 - throw new DifferentialFieldDataNotAvailableException($this); 870 - } 871 - 872 - return $this->handles; 873 - } 874 - 875 - /** 876 - * Get the list of properties for a diff set by @{method:setManualDiff}. 877 - * 878 - * @return array Array of all Diff properties. 879 - * @task context 880 - */ 881 - final public function getDiffProperties() { 882 - if ($this->diffProperties === null) { 883 - // This will be set to some (possibly empty) array if we've loaded 884 - // properties, so null means diff properties aren't available in this 885 - // context. 886 - throw new DifferentialFieldDataNotAvailableException($this); 887 - } 888 - return $this->diffProperties; 889 - } 890 - 891 - /** 892 - * Get a property of a diff set by @{method:setManualDiff}. 893 - * 894 - * @param string Diff property key. 895 - * @return mixed|null Diff property, or null if the property does not have 896 - * a value. 897 - * @task context 898 - */ 899 - final public function getDiffProperty($key) { 900 - return idx($this->getDiffProperties(), $key); 901 - } 902 - 903 - }
-6
src/applications/differential/field/specification/DifferentialFreeformFieldSpecification.php
··· 1 - <?php 2 - 3 - abstract class DifferentialFreeformFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - }
-37
src/applications/differential/field/specification/DifferentialGitSVNIDFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialGitSVNIDFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $gitSVNID; 7 - 8 - public function shouldAppearOnCommitMessage() { 9 - return true; 10 - } 11 - 12 - public function shouldAppearOnCommitMessageTemplate() { 13 - return false; 14 - } 15 - 16 - public function getCommitMessageKey() { 17 - return 'gitSVNID'; 18 - } 19 - 20 - public function setValueFromParsedCommitMessage($value) { 21 - $this->gitSVNID = $value; 22 - return $this; 23 - } 24 - 25 - public function renderLabelForCommitMessage() { 26 - return 'git-svn-id'; 27 - } 28 - 29 - public function renderValueForCommitMessage($is_edit) { 30 - return null; 31 - } 32 - 33 - public function parseValueFromCommitMessage($value) { 34 - return $value; 35 - } 36 - 37 - }
-6
src/applications/differential/field/specification/DifferentialHostFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialHostFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - }
-162
src/applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialJIRAIssuesFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $value; 7 - private $error; 8 - 9 - public function getStorageKey() { 10 - return 'phabricator:jira-issues'; 11 - } 12 - 13 - public function getValueForStorage() { 14 - return json_encode($this->value); 15 - } 16 - 17 - public function setValueFromStorage($value) { 18 - if (!strlen($value)) { 19 - $this->value = array(); 20 - } else { 21 - $this->value = json_decode($value, true); 22 - } 23 - return $this; 24 - } 25 - 26 - public function shouldAppearOnEdit() { 27 - return true; 28 - } 29 - 30 - public function setValueFromRequest(AphrontRequest $request) { 31 - $this->value = $request->getStrList($this->getStorageKey()); 32 - return $this; 33 - } 34 - 35 - public function renderEditControl() { 36 - return id(new AphrontFormTextControl()) 37 - ->setLabel(pht('JIRA Issues')) 38 - ->setCaption( 39 - pht('Example: %s', phutil_tag('tt', array(), 'JIS-3, JIS-9'))) 40 - ->setName($this->getStorageKey()) 41 - ->setValue(implode(', ', nonempty($this->value, array()))) 42 - ->setError($this->error); 43 - } 44 - 45 - public function shouldAppearOnRevisionView() { 46 - return true; 47 - } 48 - 49 - public function renderLabelForRevisionView() { 50 - return pht('JIRA Issues:'); 51 - } 52 - 53 - public function renderValueForRevisionView() { 54 - $xobjs = $this->loadDoorkeeperExternalObjects(); 55 - if (!$xobjs) { 56 - return null; 57 - } 58 - 59 - $links = array(); 60 - foreach ($xobjs as $xobj) { 61 - $links[] = id(new DoorkeeperTagView()) 62 - ->setExternalObject($xobj); 63 - } 64 - 65 - return phutil_implode_html(phutil_tag('br'), $links); 66 - } 67 - 68 - public function shouldAppearOnCommitMessage() { 69 - return true; 70 - } 71 - 72 - public function getCommitMessageKey() { 73 - return 'jira.issues'; 74 - } 75 - 76 - public function setValueFromParsedCommitMessage($value) { 77 - $this->value = $value; 78 - return $this; 79 - } 80 - 81 - public function shouldOverwriteWhenCommitMessageIsEdited() { 82 - return true; 83 - } 84 - 85 - public function renderLabelForCommitMessage() { 86 - return 'JIRA Issues'; 87 - } 88 - 89 - public function renderValueForCommitMessage($is_edit) { 90 - return implode(', ', $this->value); 91 - } 92 - 93 - public function getSupportedCommitMessageLabels() { 94 - return array( 95 - 'JIRA', 96 - 'JIRA Issues', 97 - 'JIRA Issue', 98 - ); 99 - } 100 - 101 - public function parseValueFromCommitMessage($value) { 102 - return preg_split('/[\s,]+/', $value, $limit = -1, PREG_SPLIT_NO_EMPTY); 103 - } 104 - 105 - public function validateField() { 106 - if ($this->value) { 107 - $refs = id(new DoorkeeperImportEngine()) 108 - ->setViewer($this->getUser()) 109 - ->setRefs($this->buildDoorkeeperRefs()) 110 - ->execute(); 111 - 112 - $bad = array(); 113 - foreach ($refs as $ref) { 114 - if (!$ref->getIsVisible()) { 115 - $bad[] = $ref->getObjectID(); 116 - } 117 - } 118 - 119 - if ($bad) { 120 - $bad = implode(', ', $bad); 121 - $this->error = pht('Invalid'); 122 - throw new DifferentialFieldValidationException( 123 - pht( 124 - "Some JIRA issues could not be loaded. They may not exist, or ". 125 - "you may not have permission to view them: %s", 126 - $bad)); 127 - } 128 - } 129 - } 130 - 131 - private function buildDoorkeeperRefs() { 132 - $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); 133 - 134 - $refs = array(); 135 - if ($this->value) { 136 - foreach ($this->value as $jira_key) { 137 - $refs[] = id(new DoorkeeperObjectRef()) 138 - ->setApplicationType(DoorkeeperBridgeJIRA::APPTYPE_JIRA) 139 - ->setApplicationDomain($provider->getProviderDomain()) 140 - ->setObjectType(DoorkeeperBridgeJIRA::OBJTYPE_ISSUE) 141 - ->setObjectID($jira_key); 142 - } 143 - } 144 - 145 - return $refs; 146 - } 147 - 148 - private function loadDoorkeeperExternalObjects() { 149 - $refs = $this->buildDoorkeeperRefs(); 150 - if (!$refs) { 151 - return array(); 152 - } 153 - 154 - $xobjs = id(new DoorkeeperExternalObjectQuery()) 155 - ->setViewer($this->getUser()) 156 - ->withObjectKeys(mpull($refs, 'getObjectKey')) 157 - ->execute(); 158 - 159 - return $xobjs; 160 - } 161 - 162 - }
-35
src/applications/differential/field/specification/DifferentialLinesFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialLinesFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForRevisionView() { 11 - return 'Lines:'; 12 - } 13 - 14 - public function renderValueForRevisionView() { 15 - $diff = $this->getDiff(); 16 - return number_format($diff->getLineCount()); 17 - } 18 - 19 - public function shouldAppearOnRevisionList() { 20 - return true; 21 - } 22 - 23 - public function renderHeaderForRevisionList() { 24 - return 'Lines'; 25 - } 26 - 27 - public function getColumnClassForRevisionList() { 28 - return 'n'; 29 - } 30 - 31 - public function renderValueForRevisionList(DifferentialRevision $revision) { 32 - return number_format($revision->getLineCount()); 33 - } 34 - 35 - }
+1 -229
src/applications/differential/field/specification/DifferentialLintFieldSpecification.php
··· 1 1 <?php 2 2 3 - final class DifferentialLintFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnDiffView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForDiffView() { 11 - return $this->renderLabelForRevisionView(); 12 - } 13 - 14 - public function renderValueForDiffView() { 15 - return $this->renderValueForRevisionView(); 16 - } 17 - 18 - public function shouldAppearOnRevisionView() { 19 - return true; 20 - } 21 - 22 - public function renderLabelForRevisionView() { 23 - return 'Lint:'; 24 - } 25 - 26 - private function getLintExcuse() { 27 - return $this->getDiffProperty('arc:lint-excuse'); 28 - } 29 - 30 - private function getPostponedLinters() { 31 - return $this->getDiffProperty('arc:lint-postponed'); 32 - } 33 - 34 - public function renderValueForRevisionView() { 35 - $diff = $this->getManualDiff(); 36 - $path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename'); 37 - 38 - $lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff); 39 - $lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff); 40 - $ldata = $this->getDiffProperty('arc:lint'); 41 - $ltail = null; 42 - 43 - $rows = array(); 44 - 45 - $rows[] = array( 46 - 'style' => 'star', 47 - 'name' => $lstar, 48 - 'value' => $lmsg, 49 - 'show' => true, 50 - ); 51 - 52 - $excuse = $this->getLintExcuse(); 53 - if ($excuse) { 54 - $rows[] = array( 55 - 'style' => 'excuse', 56 - 'name' => 'Excuse', 57 - 'value' => phutil_escape_html_newlines($excuse), 58 - 'show' => true, 59 - ); 60 - } 61 - 62 - $show_limit = 10; 63 - $hidden = array(); 64 - 65 - if ($ldata) { 66 - $ldata = igroup($ldata, 'path'); 67 - foreach ($ldata as $path => $messages) { 68 - 69 - $rows[] = array( 70 - 'style' => 'section', 71 - 'name' => $path, 72 - 'show' => $show_limit, 73 - ); 74 - 75 - foreach ($messages as $message) { 76 - $path = idx($message, 'path'); 77 - $line = idx($message, 'line'); 78 - 79 - $code = idx($message, 'code'); 80 - $severity = idx($message, 'severity'); 81 - 82 - $name = idx($message, 'name'); 83 - $description = idx($message, 'description'); 84 - 85 - $line_link = 'line '.intval($line); 86 - if (isset($path_changesets[$path])) { 87 - $href = '#C'.$path_changesets[$path].'NL'.max(1, $line); 88 - if ($diff->getID() != $this->getDiff()->getID()) { 89 - $href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href; 90 - } 91 - $line_link = phutil_tag( 92 - 'a', 93 - array( 94 - 'href' => $href, 95 - ), 96 - $line_link); 97 - } 98 - 99 - if ($show_limit) { 100 - --$show_limit; 101 - $show = true; 102 - } else { 103 - $show = false; 104 - if (empty($hidden[$severity])) { 105 - $hidden[$severity] = 0; 106 - } 107 - $hidden[$severity]++; 108 - } 109 - 110 - $rows[] = array( 111 - 'style' => $this->getSeverityStyle($severity), 112 - 'name' => ucwords($severity), 113 - 'value' => hsprintf( 114 - '(%s) %s at %s', 115 - $code, 116 - $name, 117 - $line_link), 118 - 'show' => $show, 119 - ); 120 - 121 - if (!empty($message['locations'])) { 122 - $locations = array(); 123 - foreach ($message['locations'] as $location) { 124 - $other_line = idx($location, 'line'); 125 - $locations[] = 126 - idx($location, 'path', $path). 127 - ($other_line ? ":{$other_line}" : ""); 128 - } 129 - $description .= "\nOther locations: ".implode(", ", $locations); 130 - } 131 - 132 - if (strlen($description)) { 133 - $rows[] = array( 134 - 'style' => 'details', 135 - 'value' => phutil_escape_html_newlines($description), 136 - 'show' => false, 137 - ); 138 - if (empty($hidden['details'])) { 139 - $hidden['details'] = 0; 140 - } 141 - $hidden['details']++; 142 - } 143 - } 144 - } 145 - } 146 - 147 - $postponed = $this->getPostponedLinters(); 148 - if ($postponed) { 149 - foreach ($postponed as $linter) { 150 - $rows[] = array( 151 - 'style' => $this->getPostponedStyle(), 152 - 'name' => 'Postponed', 153 - 'value' => $linter, 154 - 'show' => false, 155 - ); 156 - if (empty($hidden['postponed'])) { 157 - $hidden['postponed'] = 0; 158 - } 159 - $hidden['postponed']++; 160 - } 161 - } 162 - 163 - $show_string = $this->renderShowString($hidden); 164 - 165 - $view = new DifferentialResultsTableView(); 166 - $view->setRows($rows); 167 - $view->setShowMoreString($show_string); 168 - 169 - return $view->render(); 170 - } 171 - 172 - private function getSeverityStyle($severity) { 173 - $map = array( 174 - ArcanistLintSeverity::SEVERITY_ERROR => 'red', 175 - ArcanistLintSeverity::SEVERITY_WARNING => 'yellow', 176 - ArcanistLintSeverity::SEVERITY_AUTOFIX => 'yellow', 177 - ArcanistLintSeverity::SEVERITY_ADVICE => 'yellow', 178 - ); 179 - return idx($map, $severity); 180 - } 181 - 182 - private function getPostponedStyle() { 183 - return 'blue'; 184 - } 185 - 186 - private function renderShowString(array $hidden) { 187 - if (!$hidden) { 188 - return null; 189 - } 190 - 191 - // Reorder hidden things by severity. 192 - $hidden = array_select_keys( 193 - $hidden, 194 - array( 195 - ArcanistLintSeverity::SEVERITY_ERROR, 196 - ArcanistLintSeverity::SEVERITY_WARNING, 197 - ArcanistLintSeverity::SEVERITY_AUTOFIX, 198 - ArcanistLintSeverity::SEVERITY_ADVICE, 199 - 'details', 200 - 'postponed', 201 - )) + $hidden; 202 - 203 - $show = array(); 204 - foreach ($hidden as $key => $value) { 205 - switch ($key) { 206 - case ArcanistLintSeverity::SEVERITY_ERROR: 207 - $show[] = pht('%d Error(s)', $value); 208 - break; 209 - case ArcanistLintSeverity::SEVERITY_WARNING: 210 - $show[] = pht('%d Warning(s)', $value); 211 - break; 212 - case ArcanistLintSeverity::SEVERITY_AUTOFIX: 213 - $show[] = pht('%d Auto-Fix(es)', $value); 214 - break; 215 - case ArcanistLintSeverity::SEVERITY_ADVICE: 216 - $show[] = pht('%d Advice(s)', $value); 217 - break; 218 - case 'details': 219 - $show[] = pht('%d Detail(s)', $value); 220 - break; 221 - case 'postponed': 222 - $show[] = pht('%d Postponed', $value); 223 - break; 224 - default: 225 - $show[] = $value; 226 - break; 227 - } 228 - } 229 - 230 - return "Show Full Lint Results (".implode(', ', $show).")"; 231 - } 3 + final class DifferentialLintFieldSpecification { 232 4 233 5 public function renderWarningBoxForRevisionAccept() { 234 6 $status = $this->getDiff()->getLintStatus();
-130
src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialManiphestTasksFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $oldManiphestTasks = array(); 7 - private $maniphestTasks = array(); 8 - 9 - public function shouldAppearOnRevisionView() { 10 - return PhabricatorApplication::isClassInstalled( 11 - 'PhabricatorApplicationManiphest'); 12 - } 13 - 14 - public function getRequiredHandlePHIDsForRevisionView() { 15 - return $this->getManiphestTaskPHIDs(); 16 - } 17 - 18 - public function renderLabelForRevisionView() { 19 - return 'Maniphest Tasks:'; 20 - } 21 - 22 - public function renderValueForRevisionView() { 23 - $task_phids = $this->getManiphestTaskPHIDs(); 24 - if (!$task_phids) { 25 - return null; 26 - } 27 - 28 - $links = array(); 29 - foreach ($task_phids as $task_phid) { 30 - $links[] = $this->getHandle($task_phid)->renderLink(); 31 - } 32 - 33 - return phutil_implode_html(phutil_tag('br'), $links); 34 - } 35 - 36 - private function getManiphestTaskPHIDs() { 37 - $revision = $this->getRevision(); 38 - if (!$revision->getPHID()) { 39 - return array(); 40 - } 41 - return PhabricatorEdgeQuery::loadDestinationPHIDs( 42 - $revision->getPHID(), 43 - PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK); 44 - } 45 - 46 - protected function didSetRevision() { 47 - $this->maniphestTasks = $this->getManiphestTaskPHIDs(); 48 - $this->oldManiphestTasks = $this->maniphestTasks; 49 - } 50 - 51 - public function getRequiredHandlePHIDsForCommitMessage() { 52 - return $this->maniphestTasks; 53 - } 54 - 55 - public function shouldAppearOnCommitMessageTemplate() { 56 - return false; 57 - } 58 - 59 - public function shouldAppearOnCommitMessage() { 60 - return $this->shouldAppearOnRevisionView(); 61 - } 62 - 63 - public function getCommitMessageKey() { 64 - return 'maniphestTaskPHIDs'; 65 - } 66 - 67 - public function setValueFromParsedCommitMessage($value) { 68 - $this->maniphestTasks = array_unique(nonempty($value, array())); 69 - return $this; 70 - } 71 - 72 - public function renderLabelForCommitMessage() { 73 - return 'Maniphest Tasks'; 74 - } 75 - 76 - public function getSupportedCommitMessageLabels() { 77 - return array( 78 - 'Maniphest Task', 79 - 'Maniphest Tasks', 80 - ); 81 - } 82 - 83 - public function renderValueForCommitMessage($is_edit) { 84 - if (!$this->maniphestTasks) { 85 - return null; 86 - } 87 - 88 - $names = array(); 89 - foreach ($this->maniphestTasks as $phid) { 90 - $handle = $this->getHandle($phid); 91 - $names[] = $handle->getName(); 92 - } 93 - return implode(', ', $names); 94 - } 95 - 96 - public function parseValueFromCommitMessage($value) { 97 - $matches = null; 98 - preg_match_all('/T(\d+)/', $value, $matches); 99 - if (empty($matches[0])) { 100 - return array(); 101 - } 102 - 103 - // TODO: T603 Get a viewer here so we can issue the right query. 104 - 105 - $task_ids = $matches[1]; 106 - $tasks = id(new ManiphestTask()) 107 - ->loadAllWhere('id in (%Ld)', $task_ids); 108 - 109 - $task_phids = array(); 110 - $invalid = array(); 111 - foreach ($task_ids as $task_id) { 112 - $task = idx($tasks, $task_id); 113 - if (empty($task)) { 114 - $invalid[] = 'T'.$task_id; 115 - } else { 116 - $task_phids[] = $task->getPHID(); 117 - } 118 - } 119 - 120 - if ($invalid) { 121 - $what = pht('Maniphest Task(s)', count($invalid)); 122 - $invalid = implode(', ', $invalid); 123 - throw new DifferentialFieldParseException( 124 - "Commit message references nonexistent {$what}: {$invalid}."); 125 - } 126 - 127 - return $task_phids; 128 - } 129 - 130 - }
-6
src/applications/differential/field/specification/DifferentialPathFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialPathFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - }
-43
src/applications/differential/field/specification/DifferentialProjectReviewersFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialProjectReviewersFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return true; 8 - } 9 - 10 - public function getRequiredHandlePHIDsForRevisionView() { 11 - return $this->getRevision()->getReviewers(); 12 - } 13 - 14 - public function renderLabelForRevisionView() { 15 - return pht('Project Reviewers'); 16 - } 17 - 18 - public function renderValueForRevisionView() { 19 - $reviewers = array(); 20 - foreach ($this->getRevision()->getReviewerStatus() as $reviewer) { 21 - if (!$reviewer->isUser()) { 22 - $reviewers[] = $reviewer; 23 - } 24 - } 25 - 26 - if (!$reviewers) { 27 - return null; 28 - } 29 - 30 - $view = id(new DifferentialReviewersView()) 31 - ->setUser($this->getUser()) 32 - ->setReviewers($reviewers) 33 - ->setHandles($this->getLoadedHandles()); 34 - 35 - $diff = $this->getRevision()->loadActiveDiff(); 36 - if ($diff) { 37 - $view->setActiveDiff($diff); 38 - } 39 - 40 - return $view; 41 - } 42 - 43 - }
-44
src/applications/differential/field/specification/DifferentialRepositoryFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialRepositoryFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $value; 7 - 8 - public function shouldAppearOnEdit() { 9 - return true; 10 - } 11 - 12 - protected function didSetRevision() { 13 - $this->value = $this->getRevision()->getRepositoryPHID(); 14 - } 15 - 16 - public function setValueFromRequest(AphrontRequest $request) { 17 - $value = head($request->getArr('repositoryPHID')); 18 - $this->value = nonempty($value, null); 19 - return $this; 20 - } 21 - 22 - 23 - public function getRequiredHandlePHIDsForRevisionEdit() { 24 - return array_filter(array($this->value)); 25 - } 26 - 27 - public function renderEditControl() { 28 - $value = array(); 29 - if ($this->value) { 30 - $value = array( 31 - $this->getHandle($this->value), 32 - ); 33 - } 34 - 35 - return id(new AphrontFormTokenizerControl()) 36 - ->setLabel('Repository') 37 - ->setName('repositoryPHID') 38 - ->setUser($this->getUser()) 39 - ->setLimit(1) 40 - ->setDatasource('/typeahead/common/repositories/') 41 - ->setValue($value); 42 - } 43 - 44 - }
-102
src/applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialRevertPlanFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $value; 7 - 8 - public function getStorageKey() { 9 - return 'phabricator:revert-plan'; 10 - } 11 - 12 - public function getValueForStorage() { 13 - return $this->value; 14 - } 15 - 16 - public function setValueFromStorage($value) { 17 - $this->value = $value; 18 - return $this; 19 - } 20 - 21 - public function shouldAppearOnEdit() { 22 - return true; 23 - } 24 - 25 - public function setValueFromRequest(AphrontRequest $request) { 26 - $this->value = $request->getStr($this->getStorageKey()); 27 - return $this; 28 - } 29 - 30 - public function renderEditControl() { 31 - return id(new AphrontFormTextAreaControl()) 32 - ->setLabel('Revert Plan') 33 - ->setName($this->getStorageKey()) 34 - ->setCaption('Special steps required to safely revert this change.') 35 - ->setValue($this->value); 36 - } 37 - 38 - public function shouldAppearOnRevisionView() { 39 - return true; 40 - } 41 - 42 - public function renderLabelForRevisionView() { 43 - return 'Revert Plan:'; 44 - } 45 - 46 - public function renderValueForRevisionView() { 47 - if (!$this->value) { 48 - return null; 49 - } 50 - return $this->value; 51 - } 52 - 53 - public function shouldAppearOnCommitMessage() { 54 - return true; 55 - } 56 - 57 - public function getCommitMessageKey() { 58 - return 'revertPlan'; 59 - } 60 - 61 - public function setValueFromParsedCommitMessage($value) { 62 - $this->value = $value; 63 - return $this; 64 - } 65 - 66 - public function shouldOverwriteWhenCommitMessageIsEdited() { 67 - return true; 68 - } 69 - 70 - public function renderLabelForCommitMessage() { 71 - return 'Revert Plan'; 72 - } 73 - 74 - 75 - public function renderValueForCommitMessage($is_edit) { 76 - return $this->value; 77 - } 78 - 79 - public function getSupportedCommitMessageLabels() { 80 - return array( 81 - 'Revert Plan', 82 - 'Revert', 83 - ); 84 - } 85 - 86 - public function parseValueFromCommitMessage($value) { 87 - return $value; 88 - } 89 - 90 - public function shouldAddToSearchIndex() { 91 - return true; 92 - } 93 - 94 - public function getValueForSearchIndex() { 95 - return $this->value; 96 - } 97 - 98 - public function getKeyForSearchIndex() { 99 - return 'rpln'; 100 - } 101 - 102 - }
-64
src/applications/differential/field/specification/DifferentialReviewedByFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialReviewedByFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $reviewedBy; 7 - 8 - protected function didSetRevision() { 9 - $this->reviewedBy = array(); 10 - $revision = $this->getRevision(); 11 - $reviewer = $revision->loadReviewedBy(); 12 - 13 - if ($reviewer) { 14 - $this->reviewedBy = array($reviewer); 15 - } 16 - } 17 - 18 - public function shouldAppearOnCommitMessage() { 19 - return true; 20 - } 21 - 22 - public function getCommitMessageKey() { 23 - return 'reviewedByPHIDs'; 24 - } 25 - 26 - public function setValueFromParsedCommitMessage($value) { 27 - $this->reviewedBy = $value; 28 - return $this; 29 - } 30 - 31 - public function shouldAppearOnCommitMessageTemplate() { 32 - return false; 33 - } 34 - 35 - public function renderLabelForCommitMessage() { 36 - return 'Reviewed By'; 37 - } 38 - 39 - public function getRequiredHandlePHIDsForCommitMessage() { 40 - return $this->reviewedBy; 41 - } 42 - 43 - public function renderValueForCommitMessage($is_edit) { 44 - if ($is_edit) { 45 - return null; 46 - } 47 - 48 - if (!$this->reviewedBy) { 49 - return null; 50 - } 51 - 52 - $names = array(); 53 - foreach ($this->reviewedBy as $phid) { 54 - $names[] = $this->getHandle($phid)->getName(); 55 - } 56 - 57 - return implode(', ', $names); 58 - } 59 - 60 - public function parseValueFromCommitMessage($value) { 61 - return $this->parseCommitMessageUserList($value); 62 - } 63 - 64 - }
-176
src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialReviewersFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $reviewers = array(); 7 - private $error; 8 - 9 - public function shouldAppearOnRevisionView() { 10 - return true; 11 - } 12 - 13 - public function getRequiredHandlePHIDsForRevisionView() { 14 - return $this->getReviewerPHIDs(); 15 - } 16 - 17 - public function renderLabelForRevisionView() { 18 - return pht('Reviewers'); 19 - } 20 - 21 - public function renderValueForRevisionView() { 22 - $reviewers = array(); 23 - foreach ($this->getRevision()->getReviewerStatus() as $reviewer) { 24 - if ($reviewer->isUser()) { 25 - $reviewers[] = $reviewer; 26 - } 27 - } 28 - 29 - if (!$reviewers) { 30 - // Renders "None". 31 - return $this->renderUserList(array()); 32 - } 33 - 34 - $view = id(new DifferentialReviewersView()) 35 - ->setUser($this->getUser()) 36 - ->setReviewers($reviewers) 37 - ->setHandles($this->getLoadedHandles()); 38 - 39 - $diff = $this->getRevision()->loadActiveDiff(); 40 - if ($diff) { 41 - $view->setActiveDiff($diff); 42 - } 43 - 44 - return $view; 45 - } 46 - 47 - private function getReviewerPHIDs() { 48 - $revision = $this->getRevision(); 49 - return $revision->getReviewers(); 50 - } 51 - 52 - public function shouldAppearOnEdit() { 53 - return true; 54 - } 55 - 56 - protected function didSetRevision() { 57 - $this->reviewers = $this->getReviewerPHIDs(); 58 - } 59 - 60 - public function getRequiredHandlePHIDsForRevisionEdit() { 61 - return $this->reviewers; 62 - } 63 - 64 - public function setValueFromRequest(AphrontRequest $request) { 65 - $this->reviewers = $request->getArr('reviewers'); 66 - return $this; 67 - } 68 - 69 - public function validateField() { 70 - if (!$this->hasRevision()) { 71 - return; 72 - } 73 - 74 - $self = PhabricatorEnv::getEnvConfig('differential.allow-self-accept'); 75 - if ($self) { 76 - return; 77 - } 78 - 79 - $author_phid = $this->getRevision()->getAuthorPHID(); 80 - if (!in_array($author_phid, $this->reviewers)) { 81 - return; 82 - } 83 - 84 - $this->error = 'Invalid'; 85 - throw new DifferentialFieldValidationException( 86 - "The owner of a revision may not be a reviewer."); 87 - } 88 - 89 - public function renderEditControl() { 90 - $reviewer_map = array(); 91 - foreach ($this->reviewers as $phid) { 92 - $reviewer_map[] = $this->getHandle($phid); 93 - } 94 - return id(new AphrontFormTokenizerControl()) 95 - ->setLabel(pht('Reviewers')) 96 - ->setName('reviewers') 97 - ->setUser($this->getUser()) 98 - ->setDatasource('/typeahead/common/usersorprojects/') 99 - ->setValue($reviewer_map) 100 - ->setError($this->error); 101 - } 102 - 103 - public function shouldAppearOnCommitMessage() { 104 - return true; 105 - } 106 - 107 - public function getCommitMessageKey() { 108 - return 'reviewerPHIDs'; 109 - } 110 - 111 - public function setValueFromParsedCommitMessage($value) { 112 - $this->reviewers = array_unique(nonempty($value, array())); 113 - return $this; 114 - } 115 - 116 - public function renderLabelForCommitMessage() { 117 - return 'Reviewers'; 118 - } 119 - 120 - public function getRequiredHandlePHIDsForCommitMessage() { 121 - return $this->reviewers; 122 - } 123 - 124 - public function renderValueForCommitMessage($is_edit) { 125 - if (!$this->reviewers) { 126 - return null; 127 - } 128 - 129 - $names = array(); 130 - foreach ($this->reviewers as $phid) { 131 - $names[] = $this->getHandle($phid)->getObjectName(); 132 - } 133 - 134 - return implode(', ', $names); 135 - } 136 - 137 - public function getSupportedCommitMessageLabels() { 138 - return array( 139 - 'Reviewer', 140 - 'Reviewers', 141 - ); 142 - } 143 - 144 - public function parseValueFromCommitMessage($value) { 145 - return $this->parseCommitMessageUserOrProjectList($value); 146 - } 147 - 148 - public function shouldAppearOnRevisionList() { 149 - return true; 150 - } 151 - 152 - public function renderHeaderForRevisionList() { 153 - return 'Reviewers'; 154 - } 155 - 156 - public function renderValueForRevisionList(DifferentialRevision $revision) { 157 - $primary_reviewer = $revision->getPrimaryReviewer(); 158 - if ($primary_reviewer) { 159 - $names = array(); 160 - 161 - foreach ($revision->getReviewers() as $reviewer) { 162 - $names[] = $this->getHandle($reviewer)->renderLink(); 163 - } 164 - 165 - return phutil_implode_html(', ', $names); 166 - } else { 167 - return phutil_tag('em', array(), 'None'); 168 - } 169 - } 170 - 171 - public function getRequiredHandlePHIDsForRevisionList( 172 - DifferentialRevision $revision) { 173 - return $revision->getReviewers(); 174 - } 175 - 176 - }
-99
src/applications/differential/field/specification/DifferentialRevisionIDFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialRevisionIDFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $id; 7 - 8 - protected function didSetRevision() { 9 - $this->id = $this->getRevision()->getID(); 10 - } 11 - 12 - public function shouldAppearOnCommitMessage() { 13 - return true; 14 - } 15 - 16 - public function shouldAppearOnCommitMessageTemplate() { 17 - return false; 18 - } 19 - 20 - public function getCommitMessageKey() { 21 - return 'revisionID'; 22 - } 23 - 24 - public function setValueFromParsedCommitMessage($value) { 25 - $this->id = $value; 26 - return $this; 27 - } 28 - 29 - public function renderLabelForCommitMessage() { 30 - return 'Differential Revision'; 31 - } 32 - 33 - public function renderValueForCommitMessage($is_edit) { 34 - if (!$this->id) { 35 - return null; 36 - } 37 - return PhabricatorEnv::getProductionURI('/D'.$this->id); 38 - } 39 - 40 - public function parseValueFromCommitMessage($value) { 41 - $rev = trim(head(explode("\n", $value))); 42 - 43 - if (!strlen($rev)) { 44 - return null; 45 - } 46 - 47 - if (is_numeric($rev)) { 48 - // TODO: Eventually, remove support for bare revision numbers. 49 - return (int)$rev; 50 - } 51 - 52 - $rev = self::parseRevisionIDFromURI($rev); 53 - if ($rev !== null) { 54 - return $rev; 55 - } 56 - 57 - $example_uri = PhabricatorEnv::getProductionURI('/D123'); 58 - throw new DifferentialFieldParseException( 59 - "Commit references invalid 'Differential Revision'. Expected a ". 60 - "Phabricator URI like '{$example_uri}', got '{$value}'."); 61 - } 62 - 63 - public static function parseRevisionIDFromURI($uri) { 64 - $path = id(new PhutilURI($uri))->getPath(); 65 - 66 - $matches = null; 67 - if (preg_match('#^/D(\d+)$#', $path, $matches)) { 68 - $id = (int)$matches[1]; 69 - // Make sure the URI is the same as our URI. Basically, we want to ignore 70 - // commits from other Phabricator installs. 71 - if ($uri == PhabricatorEnv::getProductionURI('/D'.$id)) { 72 - return $id; 73 - } 74 - 75 - $allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id); 76 - 77 - foreach ($allowed_uris as $allowed_uri) { 78 - if ($uri == $allowed_uri) { 79 - return $id; 80 - } 81 - } 82 - } 83 - 84 - return null; 85 - } 86 - 87 - public function shouldAppearOnRevisionList() { 88 - return true; 89 - } 90 - 91 - public function renderHeaderForRevisionList() { 92 - return 'ID'; 93 - } 94 - 95 - public function renderValueForRevisionList(DifferentialRevision $revision) { 96 - return 'D'.$revision->getID(); 97 - } 98 - 99 - }
-23
src/applications/differential/field/specification/DifferentialRevisionStatusFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialRevisionStatusFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnRevisionView() { 7 - return false; 8 - } 9 - 10 - public function shouldAppearOnRevisionList() { 11 - return true; 12 - } 13 - 14 - public function renderHeaderForRevisionList() { 15 - return 'Status'; 16 - } 17 - 18 - public function renderValueForRevisionList(DifferentialRevision $revision) { 19 - return ArcanistDifferentialRevisionStatus::getNameForRevisionStatus( 20 - $revision->getStatus()); 21 - } 22 - 23 - }
-89
src/applications/differential/field/specification/DifferentialSummaryFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialSummaryFieldSpecification 4 - extends DifferentialFreeformFieldSpecification { 5 - 6 - private $summary = ''; 7 - private $controlID; 8 - 9 - public function shouldAppearOnEdit() { 10 - return true; 11 - } 12 - 13 - protected function didSetRevision() { 14 - $this->summary = (string)$this->getRevision()->getSummary(); 15 - } 16 - 17 - public function setValueFromRequest(AphrontRequest $request) { 18 - $this->summary = $request->getStr('summary'); 19 - return $this; 20 - } 21 - 22 - public function renderEditControl() { 23 - return id(new PhabricatorRemarkupControl()) 24 - ->setLabel(pht('Summary')) 25 - ->setName('summary') 26 - ->setID($this->getControlID()) 27 - ->setValue($this->summary); 28 - } 29 - 30 - public function renderEditPreview() { 31 - return id(new PHUIRemarkupPreviewPanel()) 32 - ->setHeader(pht('Summary Preview')) 33 - ->setControlID($this->getControlID()) 34 - ->setPreviewURI('/differential/preview/'); 35 - } 36 - 37 - public function shouldExtractMentions() { 38 - return true; 39 - } 40 - 41 - public function shouldAppearOnCommitMessage() { 42 - return true; 43 - } 44 - 45 - public function getCommitMessageKey() { 46 - return 'summary'; 47 - } 48 - 49 - public function setValueFromParsedCommitMessage($value) { 50 - $this->summary = (string)$value; 51 - return $this; 52 - } 53 - 54 - public function shouldOverwriteWhenCommitMessageIsEdited() { 55 - return true; 56 - } 57 - 58 - public function renderLabelForCommitMessage() { 59 - return 'Summary'; 60 - } 61 - 62 - public function renderValueForCommitMessage($is_edit) { 63 - return $this->summary; 64 - } 65 - 66 - public function parseValueFromCommitMessage($value) { 67 - return (string)$value; 68 - } 69 - 70 - public function shouldAddToSearchIndex() { 71 - return true; 72 - } 73 - 74 - public function getValueForSearchIndex() { 75 - return $this->summary; 76 - } 77 - 78 - public function getKeyForSearchIndex() { 79 - return PhabricatorSearchField::FIELD_BODY; 80 - } 81 - 82 - private function getControlID() { 83 - if (!$this->controlID) { 84 - $this->controlID = celerity_generate_unique_node_id(); 85 - } 86 - return $this->controlID; 87 - } 88 - 89 - }
-112
src/applications/differential/field/specification/DifferentialTestPlanFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialTestPlanFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $plan = ''; 7 - 8 - // NOTE: This means "uninitialized". 9 - private $error = false; 10 - 11 - public function shouldAppearOnEdit() { 12 - return false; 13 - } 14 - 15 - protected function didSetRevision() { 16 - $this->plan = (string)$this->getRevision()->getTestPlan(); 17 - } 18 - 19 - public function setValueFromRequest(AphrontRequest $request) { 20 - $this->plan = $request->getStr('testplan'); 21 - $this->error = null; 22 - return $this; 23 - } 24 - 25 - public function renderEditControl() { 26 - if ($this->error === false) { 27 - if ($this->isRequired()) { 28 - $this->error = true; 29 - } else { 30 - $this->error = null; 31 - } 32 - } 33 - 34 - return id(new PhabricatorRemarkupControl()) 35 - ->setLabel('Test Plan') 36 - ->setName('testplan') 37 - ->setValue($this->plan) 38 - ->setError($this->error); 39 - } 40 - 41 - public function shouldExtractMentions() { 42 - return true; 43 - } 44 - 45 - public function validateField() { 46 - if ($this->isRequired()) { 47 - if (!strlen($this->plan)) { 48 - $this->error = 'Required'; 49 - throw new DifferentialFieldValidationException( 50 - "You must provide a test plan."); 51 - } 52 - } 53 - } 54 - 55 - public function shouldAppearOnCommitMessage() { 56 - return false; 57 - } 58 - 59 - public function getCommitMessageKey() { 60 - return 'testPlan'; 61 - } 62 - 63 - public function setValueFromParsedCommitMessage($value) { 64 - $this->plan = (string)$value; 65 - return $this; 66 - } 67 - 68 - public function shouldOverwriteWhenCommitMessageIsEdited() { 69 - return true; 70 - } 71 - 72 - public function renderLabelForCommitMessage() { 73 - return 'Test Plan'; 74 - } 75 - 76 - public function getSupportedCommitMessageLabels() { 77 - return array( 78 - 'Test Plan', 79 - 'Testplan', 80 - 'Tested', 81 - 'Tests', 82 - ); 83 - } 84 - 85 - 86 - public function renderValueForCommitMessage($is_edit) { 87 - return $this->plan; 88 - } 89 - 90 - public function parseValueFromCommitMessage($value) { 91 - return $value; 92 - } 93 - 94 - public function shouldAddToSearchIndex() { 95 - return true; 96 - } 97 - 98 - public function getValueForSearchIndex() { 99 - return $this->plan; 100 - } 101 - 102 - public function getKeyForSearchIndex() { 103 - return 'tpln'; 104 - } 105 - 106 - private function isRequired() { 107 - return PhabricatorEnv::getEnvConfig('differential.require-test-plan-field'); 108 - } 109 - 110 - 111 - 112 - }
-107
src/applications/differential/field/specification/DifferentialTitleFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialTitleFieldSpecification 4 - extends DifferentialFreeformFieldSpecification { 5 - 6 - private $title; 7 - private $error = true; 8 - 9 - public function shouldAppearOnEdit() { 10 - return true; 11 - } 12 - 13 - protected function didSetRevision() { 14 - $this->title = $this->getRevision()->getTitle(); 15 - } 16 - 17 - public function setValueFromRequest(AphrontRequest $request) { 18 - $this->title = $request->getStr('title'); 19 - $this->error = null; 20 - return $this; 21 - } 22 - 23 - public function renderEditControl() { 24 - return id(new AphrontFormTextAreaControl()) 25 - ->setLabel('Title') 26 - ->setName('title') 27 - ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT) 28 - ->setError($this->error) 29 - ->setValue($this->title); 30 - } 31 - 32 - public function shouldExtractMentions() { 33 - return true; 34 - } 35 - 36 - public function validateField() { 37 - if (!strlen($this->title)) { 38 - $this->error = 'Required'; 39 - throw new DifferentialFieldValidationException( 40 - "You must provide a revision title in the first line ". 41 - "of your commit message."); 42 - } 43 - 44 - if (preg_match('/^<<.*>>$/', $this->title)) { 45 - $default_title = self::getDefaultRevisionTitle(); 46 - $this->error = 'Required'; 47 - throw new DifferentialFieldValidationException( 48 - "Replace the line '{$default_title}' with a revision title ". 49 - "that describes the change."); 50 - } 51 - } 52 - 53 - public function shouldAppearOnCommitMessage() { 54 - return true; 55 - } 56 - 57 - public function getCommitMessageKey() { 58 - return 'title'; 59 - } 60 - 61 - public function setValueFromParsedCommitMessage($value) { 62 - $this->title = $value; 63 - return $this; 64 - } 65 - 66 - public function shouldOverwriteWhenCommitMessageIsEdited() { 67 - return true; 68 - } 69 - 70 - public function renderLabelForCommitMessage() { 71 - return 'Title'; 72 - } 73 - 74 - public function renderValueForCommitMessage($is_edit) { 75 - return $this->title; 76 - } 77 - 78 - public function parseValueFromCommitMessage($value) { 79 - return preg_replace('/\s*\n\s*/', ' ', $value); 80 - } 81 - 82 - public function shouldAppearOnRevisionList() { 83 - return true; 84 - } 85 - 86 - public function renderHeaderForRevisionList() { 87 - return 'Revision'; 88 - } 89 - 90 - public function getColumnClassForRevisionList() { 91 - return 'wide pri'; 92 - } 93 - 94 - public static function getDefaultRevisionTitle() { 95 - return '<<Replace this line with your Revision Title>>'; 96 - } 97 - 98 - public function renderValueForRevisionList(DifferentialRevision $revision) { 99 - return phutil_tag( 100 - 'a', 101 - array( 102 - 'href' => '/D'.$revision->getID(), 103 - ), 104 - $revision->getTitle()); 105 - } 106 - 107 - }
+1 -199
src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php
··· 1 1 <?php 2 2 3 - final class DifferentialUnitFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - public function shouldAppearOnDiffView() { 7 - return true; 8 - } 9 - 10 - public function renderLabelForDiffView() { 11 - return $this->renderLabelForRevisionView(); 12 - } 13 - 14 - public function renderValueForDiffView() { 15 - return $this->renderValueForRevisionView(); 16 - } 17 - 18 - public function shouldAppearOnRevisionView() { 19 - return true; 20 - } 21 - 22 - public function renderLabelForRevisionView() { 23 - return 'Unit:'; 24 - } 25 - 26 - private function getUnitExcuse() { 27 - return $this->getDiffProperty('arc:unit-excuse'); 28 - } 29 - 30 - public function renderValueForRevisionView() { 31 - $diff = $this->getManualDiff(); 32 - 33 - $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff); 34 - $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff); 35 - 36 - $rows = array(); 37 - 38 - $rows[] = array( 39 - 'style' => 'star', 40 - 'name' => $ustar, 41 - 'value' => $umsg, 42 - 'show' => true, 43 - ); 44 - 45 - $excuse = $this->getUnitExcuse(); 46 - if ($excuse) { 47 - $rows[] = array( 48 - 'style' => 'excuse', 49 - 'name' => 'Excuse', 50 - 'value' => phutil_escape_html_newlines($excuse), 51 - 'show' => true, 52 - ); 53 - } 54 - 55 - $show_limit = 10; 56 - $hidden = array(); 57 - 58 - $udata = $this->getDiffProperty('arc:unit'); 59 - if ($udata) { 60 - $sort_map = array( 61 - ArcanistUnitTestResult::RESULT_BROKEN => 0, 62 - ArcanistUnitTestResult::RESULT_FAIL => 1, 63 - ArcanistUnitTestResult::RESULT_UNSOUND => 2, 64 - ArcanistUnitTestResult::RESULT_SKIP => 3, 65 - ArcanistUnitTestResult::RESULT_POSTPONED => 4, 66 - ArcanistUnitTestResult::RESULT_PASS => 5, 67 - ); 68 - 69 - foreach ($udata as $key => $test) { 70 - $udata[$key]['sort'] = idx($sort_map, idx($test, 'result')); 71 - } 72 - $udata = isort($udata, 'sort'); 73 - $engine = new PhabricatorMarkupEngine(); 74 - $engine->setViewer($this->getUser()); 75 - $markup_objects = array(); 76 - foreach ($udata as $key => $test) { 77 - $userdata = idx($test, 'userdata'); 78 - if ($userdata) { 79 - if ($userdata !== false) { 80 - $userdata = str_replace("\000", '', $userdata); 81 - } 82 - $markup_object = id(new PhabricatorMarkupOneOff()) 83 - ->setContent($userdata) 84 - ->setPreserveLinebreaks(true); 85 - $engine->addObject($markup_object, 'default'); 86 - $markup_objects[$key] = $markup_object; 87 - } 88 - } 89 - $engine->process(); 90 - foreach ($udata as $key => $test) { 91 - $result = idx($test, 'result'); 92 - 93 - $default_hide = false; 94 - switch ($result) { 95 - case ArcanistUnitTestResult::RESULT_POSTPONED: 96 - case ArcanistUnitTestResult::RESULT_PASS: 97 - $default_hide = true; 98 - break; 99 - } 100 - 101 - if ($show_limit && !$default_hide) { 102 - --$show_limit; 103 - $show = true; 104 - } else { 105 - $show = false; 106 - if (empty($hidden[$result])) { 107 - $hidden[$result] = 0; 108 - } 109 - $hidden[$result]++; 110 - } 111 - 112 - $value = idx($test, 'name'); 113 - if (!empty($test['link'])) { 114 - $value = phutil_tag( 115 - 'a', 116 - array( 117 - 'href' => $test['link'], 118 - 'target' => '_blank', 119 - ), 120 - $value); 121 - } 122 - $rows[] = array( 123 - 'style' => $this->getResultStyle($result), 124 - 'name' => ucwords($result), 125 - 'value' => $value, 126 - 'show' => $show, 127 - ); 128 - 129 - if (isset($markup_objects[$key])) { 130 - $rows[] = array( 131 - 'style' => 'details', 132 - 'value' => $engine->getOutput($markup_objects[$key], 'default'), 133 - 'show' => false, 134 - ); 135 - if (empty($hidden['details'])) { 136 - $hidden['details'] = 0; 137 - } 138 - $hidden['details']++; 139 - } 140 - } 141 - } 142 - 143 - $show_string = $this->renderShowString($hidden); 144 - 145 - $view = new DifferentialResultsTableView(); 146 - $view->setRows($rows); 147 - $view->setShowMoreString($show_string); 148 - 149 - return $view->render(); 150 - } 151 - 152 - private function getResultStyle($result) { 153 - $map = array( 154 - ArcanistUnitTestResult::RESULT_PASS => 'green', 155 - ArcanistUnitTestResult::RESULT_FAIL => 'red', 156 - ArcanistUnitTestResult::RESULT_SKIP => 'blue', 157 - ArcanistUnitTestResult::RESULT_BROKEN => 'red', 158 - ArcanistUnitTestResult::RESULT_UNSOUND => 'yellow', 159 - ArcanistUnitTestResult::RESULT_POSTPONED => 'blue', 160 - ); 161 - return idx($map, $result); 162 - } 163 - 164 - private function renderShowString(array $hidden) { 165 - if (!$hidden) { 166 - return null; 167 - } 168 - 169 - // Reorder hidden things by severity. 170 - $hidden = array_select_keys( 171 - $hidden, 172 - array( 173 - ArcanistUnitTestResult::RESULT_BROKEN, 174 - ArcanistUnitTestResult::RESULT_FAIL, 175 - ArcanistUnitTestResult::RESULT_UNSOUND, 176 - ArcanistUnitTestResult::RESULT_SKIP, 177 - ArcanistUnitTestResult::RESULT_POSTPONED, 178 - ArcanistUnitTestResult::RESULT_PASS, 179 - 'details', 180 - )) + $hidden; 181 - 182 - $noun = array( 183 - ArcanistUnitTestResult::RESULT_BROKEN => 'Broken', 184 - ArcanistUnitTestResult::RESULT_FAIL => 'Failed', 185 - ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound', 186 - ArcanistUnitTestResult::RESULT_SKIP => 'Skipped', 187 - ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed', 188 - ArcanistUnitTestResult::RESULT_PASS => 'Passed', 189 - ); 190 - 191 - $show = array(); 192 - foreach ($hidden as $key => $value) { 193 - if ($key == 'details') { 194 - $show[] = pht('%d Detail(s)', $value); 195 - } else { 196 - $show[] = $value.' '.idx($noun, $key); 197 - } 198 - } 199 - 200 - return "Show Full Unit Results (".implode(', ', $show).")"; 201 - } 3 + final class DifferentialUnitFieldSpecification { 202 4 203 5 public function renderWarningBoxForRevisionAccept() { 204 6 $diff = $this->getDiff();
-38
src/applications/differential/field/specification/DifferentialViewPolicyFieldSpecification.php
··· 1 - <?php 2 - 3 - final class DifferentialViewPolicyFieldSpecification 4 - extends DifferentialFieldSpecification { 5 - 6 - private $value; 7 - 8 - public function shouldAppearOnEdit() { 9 - return true; 10 - } 11 - 12 - protected function didSetRevision() { 13 - $this->value = $this->getRevision()->getViewPolicy(); 14 - } 15 - 16 - public function setValueFromRequest(AphrontRequest $request) { 17 - $this->value = $request->getStr('viewPolicy'); 18 - return $this; 19 - } 20 - 21 - public function renderEditControl() { 22 - $viewer = $this->getUser(); 23 - $revision = $this->getRevision(); 24 - 25 - $policies = id(new PhabricatorPolicyQuery()) 26 - ->setViewer($viewer) 27 - ->setObject($revision) 28 - ->execute(); 29 - 30 - return id(new AphrontFormPolicyControl()) 31 - ->setUser($viewer) 32 - ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 33 - ->setPolicyObject($revision) 34 - ->setPolicies($policies) 35 - ->setName('viewPolicy'); 36 - } 37 - 38 - }
-32
src/applications/differential/field/specification/__tests__/DifferentialRevisionIDFieldParserTestCase.php
··· 1 - <?php 2 - 3 - final class DifferentialRevisionIDFieldParserTestCase 4 - extends PhabricatorTestCase { 5 - 6 - public function testFieldParser() { 7 - 8 - $this->assertEqual( 9 - null, 10 - $this->parse('123')); 11 - 12 - $this->assertEqual( 13 - null, 14 - $this->parse('D123')); 15 - 16 - // NOTE: We expect foreign, validly-formatted URIs to be ignored. 17 - $this->assertEqual( 18 - null, 19 - $this->parse('http://phabricator.example.com/D123')); 20 - 21 - $this->assertEqual( 22 - 123, 23 - $this->parse(PhabricatorEnv::getProductionURI('/D123'))); 24 - 25 - } 26 - 27 - private function parse($value) { 28 - return DifferentialRevisionIDFieldSpecification::parseRevisionIDFromURI( 29 - $value); 30 - } 31 - 32 - }
-40
src/applications/differential/storage/DifferentialAuxiliaryField.php
··· 1 - <?php 2 - 3 - final class DifferentialAuxiliaryField { 4 - 5 - public static function loadFromStorage( 6 - DifferentialRevision $revision, 7 - array $aux_fields) { 8 - assert_instances_of($aux_fields, 'DifferentialFieldSpecification'); 9 - 10 - $storage_keys = array_filter(mpull($aux_fields, 'getStorageKey')); 11 - $field_data = array(); 12 - if ($storage_keys) { 13 - $index_map = array(); 14 - foreach ($storage_keys as $key) { 15 - $index_map[PhabricatorHash::digestForIndex($key)] = $key; 16 - } 17 - 18 - $index_data = id(new DifferentialCustomFieldStorage())->loadAllWhere( 19 - 'objectPHID = %s AND fieldIndex IN (%Ls)', 20 - $revision->getPHID(), 21 - array_keys($index_map)); 22 - $index_data = mpull($index_data, 'getFieldValue', 'getFieldIndex'); 23 - 24 - foreach ($index_data as $index => $data) { 25 - $field_data[$index_map[$index]] = $data; 26 - } 27 - } 28 - 29 - foreach ($aux_fields as $aux_field) { 30 - $aux_field->setRevision($revision); 31 - $key = $aux_field->getStorageKey(); 32 - if ($key) { 33 - $aux_field->setValueFromStorage(idx($field_data, $key)); 34 - } 35 - } 36 - 37 - return $aux_fields; 38 - } 39 - 40 - }
+3 -2
src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
··· 16 16 * button.) 17 17 * 18 18 */ 19 - final class DifferentialReleephRequestFieldSpecification 20 - extends DifferentialFieldSpecification { 19 + final class DifferentialReleephRequestFieldSpecification { 20 + 21 + // TODO: This class is essentially dead right now, see T2222. 21 22 22 23 const ACTION_PICKS = 'picks'; 23 24 const ACTION_REVERTS = 'reverts';