@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.

Move "Next Step" to a custom field in Differential

Summary:
Fixes T9672. This was never turned into a custom field, for no particular reason. Convert it into one.

This is substantially similar to the existing "Apply Patch" field, which does the same thing (only shows a command).

We might rethink or remove this eventually (e.g., in a post-"Land Revision" world) but this makes it easier, at the very least.

Test Plan:
- Viewed a non-accepted revision (no hint).
- Viewed an accepted revision from a raw diff source (no hint).
- Viewed an accepted revision from Git (`arc land` hint).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9672

Differential Revision: https://secure.phabricator.com/D14367

authored by

epriestley and committed by
epriestley
2c3dbc48 1b833787

+69 -30
+2
src/__phutil_library_map__.php
··· 416 416 'DifferentialLocalCommitsView' => 'applications/differential/view/DifferentialLocalCommitsView.php', 417 417 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php', 418 418 'DifferentialModernHunk' => 'applications/differential/storage/DifferentialModernHunk.php', 419 + 'DifferentialNextStepField' => 'applications/differential/customfield/DifferentialNextStepField.php', 419 420 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 420 421 'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php', 421 422 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', ··· 4160 4161 'DifferentialLocalCommitsView' => 'AphrontView', 4161 4162 'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField', 4162 4163 'DifferentialModernHunk' => 'DifferentialHunk', 4164 + 'DifferentialNextStepField' => 'DifferentialCustomField', 4163 4165 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 4164 4166 'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod', 4165 4167 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',
+2
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 25 25 $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType'; 26 26 27 27 $fields = array( 28 + new DifferentialNextStepField(), 29 + 28 30 new DifferentialTitleField(), 29 31 new DifferentialSummaryField(), 30 32 new DifferentialTestPlanField(),
+65
src/applications/differential/customfield/DifferentialNextStepField.php
··· 1 + <?php 2 + 3 + final class DifferentialNextStepField 4 + extends DifferentialCustomField { 5 + 6 + public function getFieldKey() { 7 + return 'differential:next-step'; 8 + } 9 + 10 + public function getFieldName() { 11 + return pht('Next Step'); 12 + } 13 + 14 + public function getFieldDescription() { 15 + return pht('Provides a hint for the next step to take.'); 16 + } 17 + 18 + public function shouldAppearInPropertyView() { 19 + return true; 20 + } 21 + 22 + public function renderPropertyViewLabel() { 23 + return $this->getFieldName(); 24 + } 25 + 26 + public function renderPropertyViewValue(array $handles) { 27 + $revision = $this->getObject(); 28 + $diff = $revision->getActiveDiff(); 29 + 30 + $status = $revision->getStatus(); 31 + if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) { 32 + return null; 33 + } 34 + 35 + $local_vcs = $diff->getSourceControlSystem(); 36 + switch ($local_vcs) { 37 + case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 38 + $bookmark = $diff->getBookmark(); 39 + if (strlen($bookmark)) { 40 + $next_step = csprintf('arc land %R', $bookmark); 41 + } else { 42 + $next_step = csprintf('arc land'); 43 + } 44 + break; 45 + case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 46 + $branch = $diff->getBranch(); 47 + if (strlen($branch)) { 48 + $next_step = csprintf('arc land %R', $branch); 49 + } else { 50 + $next_step = csprintf('arc land'); 51 + } 52 + break; 53 + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 54 + $next_step = csprintf('arc commit'); 55 + break; 56 + default: 57 + return null; 58 + } 59 + 60 + $next_step = phutil_tag('tt', array(), (string)$next_step); 61 + 62 + return $next_step; 63 + } 64 + 65 + }
-30
src/applications/differential/view/DifferentialRevisionDetailView.php
··· 73 73 ->setUser($user) 74 74 ->setObject($revision); 75 75 76 - $status = $revision->getStatus(); 77 - $local_vcs = $this->getDiff()->getSourceControlSystem(); 78 - 79 - $next_step = null; 80 - if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) { 81 - switch ($local_vcs) { 82 - case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 83 - $bookmark = $this->getDiff()->getBookmark(); 84 - $next_step = ($bookmark != '' 85 - ? csprintf('arc land %s', $bookmark) 86 - : 'arc land'); 87 - break; 88 - 89 - case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 90 - $branch = $this->getDiff()->getBranch(); 91 - $next_step = ($branch != '' 92 - ? csprintf('arc land %s', $branch) 93 - : 'arc land'); 94 - break; 95 - 96 - case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 97 - $next_step = 'arc commit'; 98 - break; 99 - } 100 - } 101 - if ($next_step) { 102 - $next_step = phutil_tag('tt', array(), $next_step); 103 - $properties->addProperty(pht('Next Step'), $next_step); 104 - } 105 - 106 76 $properties->setHasKeyboardShortcuts(true); 107 77 $properties->setActionList($actions); 108 78 $this->setActionList($actions);