@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 "Revision ID" custom field

Summary: Ref T11114. Obsoleted by `DifferentialRevisionIDCommitMessageField`.

Test Plan:
- Grepped for removed class.
- Created a new revision, verified that the amended message included a proper revision ID.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

+1 -92
-2
src/__phutil_library_map__.php
··· 532 532 'DifferentialRevisionHeraldField' => 'applications/differential/herald/DifferentialRevisionHeraldField.php', 533 533 'DifferentialRevisionHeraldFieldGroup' => 'applications/differential/herald/DifferentialRevisionHeraldFieldGroup.php', 534 534 'DifferentialRevisionIDCommitMessageField' => 'applications/differential/field/DifferentialRevisionIDCommitMessageField.php', 535 - 'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php', 536 535 'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php', 537 536 'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php', 538 537 'DifferentialRevisionListView' => 'applications/differential/view/DifferentialRevisionListView.php', ··· 5199 5198 'DifferentialRevisionHeraldField' => 'HeraldField', 5200 5199 'DifferentialRevisionHeraldFieldGroup' => 'HeraldFieldGroup', 5201 5200 'DifferentialRevisionIDCommitMessageField' => 'DifferentialCommitMessageField', 5202 - 'DifferentialRevisionIDField' => 'DifferentialCustomField', 5203 5201 'DifferentialRevisionLandController' => 'DifferentialController', 5204 5202 'DifferentialRevisionListController' => 'DifferentialController', 5205 5203 'DifferentialRevisionListView' => 'AphrontView',
+1 -3
src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php
··· 37 37 38 38 $errors = $parser->getErrors(); 39 39 40 - // grab some extra information about the Differential Revision: field... 41 - $revision_id_field = new DifferentialRevisionIDField(); 42 40 $revision_id_value = idx( 43 41 $field_map, 44 - $revision_id_field->getFieldKeyForConduit()); 42 + DifferentialRevisionIDCommitMessageField::FIELDKEY); 45 43 $revision_id_valid_domain = PhabricatorEnv::getProductionURI(''); 46 44 47 45 return array(
-2
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 49 49 new DifferentialLintField(), 50 50 new DifferentialUnitField(), 51 51 new DifferentialRevertPlanField(), 52 - 53 - new DifferentialRevisionIDField(), 54 52 ); 55 53 56 54 $default_fields = array();
-85
src/applications/differential/customfield/DifferentialRevisionIDField.php
··· 1 - <?php 2 - 3 - final class DifferentialRevisionIDField 4 - extends DifferentialCustomField { 5 - 6 - private $revisionID; 7 - 8 - public function getFieldKey() { 9 - return 'differential:revision-id'; 10 - } 11 - 12 - public function getFieldKeyForConduit() { 13 - return 'revisionID'; 14 - } 15 - 16 - public function getFieldName() { 17 - return pht('Differential Revision'); 18 - } 19 - 20 - public function getFieldDescription() { 21 - return pht( 22 - 'Ties commits to revisions and provides a permanent link between them.'); 23 - } 24 - 25 - public function canDisableField() { 26 - return false; 27 - } 28 - 29 - public function shouldAppearInCommitMessage() { 30 - return true; 31 - } 32 - 33 - public function parseValueFromCommitMessage($value) { 34 - // If the value is just "D123" or similar, parse the ID from it directly. 35 - $value = trim($value); 36 - $matches = null; 37 - if (preg_match('/^[dD]([1-9]\d*)\z/', $value, $matches)) { 38 - return (int)$matches[1]; 39 - } 40 - 41 - // Otherwise, try to extract a URI value. 42 - return self::parseRevisionIDFromURI($value); 43 - } 44 - 45 - public function renderCommitMessageValue(array $handles) { 46 - $id = coalesce($this->revisionID, $this->getObject()->getID()); 47 - if (!$id) { 48 - return null; 49 - } 50 - return PhabricatorEnv::getProductionURI('/D'.$id); 51 - } 52 - 53 - public function readValueFromCommitMessage($value) { 54 - $this->revisionID = $value; 55 - } 56 - 57 - private static function parseRevisionIDFromURI($uri_string) { 58 - $uri = new PhutilURI($uri_string); 59 - $path = $uri->getPath(); 60 - 61 - $matches = null; 62 - if (preg_match('#^/D(\d+)$#', $path, $matches)) { 63 - $id = (int)$matches[1]; 64 - 65 - $prod_uri = new PhutilURI(PhabricatorEnv::getProductionURI('/D'.$id)); 66 - 67 - // Make sure the URI is the same as our URI. Basically, we want to ignore 68 - // commits from other Phabricator installs. 69 - if ($uri->getDomain() == $prod_uri->getDomain()) { 70 - return $id; 71 - } 72 - 73 - $allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id); 74 - 75 - foreach ($allowed_uris as $allowed_uri) { 76 - if ($uri_string == $allowed_uri) { 77 - return $id; 78 - } 79 - } 80 - } 81 - 82 - return null; 83 - } 84 - 85 - }