1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Remove some remnants of the old ways commit mesage fields worked from Differential

Summary:
Ref T11114. Ref T12085. I missed a few pieces of cleanup when moving all this stuff over.

In particular, load all fields which use Custom Field storage before doing commit-message-related stuff, instead of just the ones that claim they appear on commit messages.

Test Plan: Edited revisions and made API calls without apparent issues. See followup on T12085, shortly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12085, T11114

Differential Revision: https://secure.phabricator.com/D17207
This commit is contained in:
epriestley 2017-01-13 15:05:39 -08:00
parent 36e53fd5d0
commit 62cf4e6b95
8 changed files with 4 additions and 197 deletions

View file

@ -142,9 +142,11 @@ final class DifferentialGetCommitMessageConduitAPIMethod
private function loadCustomFieldStorage( private function loadCustomFieldStorage(
PhabricatorUser $viewer, PhabricatorUser $viewer,
DifferentialRevision $revision) { DifferentialRevision $revision) {
$custom_field_list = PhabricatorCustomField::getObjectFields( $custom_field_list = PhabricatorCustomField::getObjectFields(
$revision, $revision,
DifferentialCustomField::ROLE_COMMITMESSAGE); PhabricatorCustomField::ROLE_STORAGE);
$custom_field_list $custom_field_list
->setViewer($viewer) ->setViewer($viewer)
->readFieldsFromStorage($revision); ->readFieldsFromStorage($revision);

View file

@ -36,10 +36,6 @@ final class DifferentialAuditorsField
return true; return true;
} }
public function shouldAppearInCommitMessage() {
return true;
}
public function shouldAppearInConduitTransactions() { public function shouldAppearInConduitTransactions() {
return true; return true;
} }

View file

@ -91,10 +91,6 @@ final class DifferentialBlameRevisionField
$xaction->renderHandleLink($object_phid)); $xaction->renderHandleLink($object_phid));
} }
public function shouldAppearInCommitMessage() {
return true;
}
public function shouldAppearInConduitDictionary() { public function shouldAppearInConduitDictionary() {
return true; return true;
} }

View file

@ -156,15 +156,6 @@ abstract class DifferentialCoreCustomField
return $this->value; return $this->value;
} }
public function readValueFromCommitMessage($value) {
$this->setValue($value);
return $this;
}
public function renderCommitMessageValue(array $handles) {
return $this->getValue();
}
public function getConduitDictionaryValue() { public function getConduitDictionaryValue() {
return $this->getValue(); return $this->getValue();
} }

View file

@ -7,9 +7,6 @@
abstract class DifferentialCustomField abstract class DifferentialCustomField
extends PhabricatorCustomField { extends PhabricatorCustomField {
const ROLE_COMMITMESSAGE = 'differential:commitmessage';
const ROLE_COMMITMESSAGEEDIT = 'differential:commitmessageedit';
/** /**
* TODO: It would be nice to remove this, but a lot of different code is * TODO: It would be nice to remove this, but a lot of different code is
* bound together by it. Until everything is modernized, retaining the old * bound together by it. Until everything is modernized, retaining the old
@ -25,18 +22,6 @@ abstract class DifferentialCustomField
return $this->getFieldKeyForConduit(); return $this->getFieldKeyForConduit();
} }
public function shouldEnableForRole($role) {
switch ($role) {
case self::ROLE_COMMITMESSAGE:
return $this->shouldAppearInCommitMessage();
case self::ROLE_COMMITMESSAGEEDIT:
return $this->shouldAppearInCommitMessage() &&
$this->shouldAllowEditInCommitMessage();
}
return parent::shouldEnableForRole($role);
}
protected function parseObjectList( protected function parseObjectList(
$value, $value,
array $types, array $types,
@ -97,39 +82,6 @@ abstract class DifferentialCustomField
/* -( Integration with Commit Messages )----------------------------------- */ /* -( Integration with Commit Messages )----------------------------------- */
/**
* @task commitmessage
*/
public function shouldAppearInCommitMessage() {
if ($this->getProxy()) {
return $this->getProxy()->shouldAppearInCommitMessage();
}
return false;
}
/**
* @task commitmessage
*/
public function shouldAppearInCommitMessageTemplate() {
if ($this->getProxy()) {
return $this->getProxy()->shouldAppearInCommitMessageTemplate();
}
return false;
}
/**
* @task commitmessage
*/
public function shouldAllowEditInCommitMessage() {
if ($this->getProxy()) {
return $this->getProxy()->shouldAllowEditInCommitMessage();
}
return true;
}
/** /**
* @task commitmessage * @task commitmessage
*/ */
@ -141,95 +93,6 @@ abstract class DifferentialCustomField
} }
/**
* @task commitmessage
*/
public function getCommitMessageLabels() {
if ($this->getProxy()) {
return $this->getProxy()->getCommitMessageLabels();
}
return array($this->renderCommitMessageLabel());
}
/**
* @task commitmessage
*/
public function parseValueFromCommitMessage($value) {
if ($this->getProxy()) {
return $this->getProxy()->parseValueFromCommitMessage($value);
}
return $value;
}
/**
* @task commitmessage
*/
public function readValueFromCommitMessage($value) {
if ($this->getProxy()) {
$this->getProxy()->readValueFromCommitMessage($value);
return $this;
}
return $this;
}
/**
* @task commitmessage
*/
public function shouldOverwriteWhenCommitMessageIsEdited() {
if ($this->getProxy()) {
return $this->getProxy()->shouldOverwriteWhenCommitMessageIsEdited();
}
return false;
}
/**
* @task commitmessage
*/
public function getRequiredHandlePHIDsForCommitMessage() {
if ($this->getProxy()) {
return $this->getProxy()->getRequiredHandlePHIDsForCommitMessage();
}
return array();
}
/**
* @task commitmessage
*/
public function renderCommitMessageLabel() {
if ($this->getProxy()) {
return $this->getProxy()->renderCommitMessageLabel();
}
return $this->getFieldName();
}
/**
* @task commitmessage
*/
public function renderCommitMessageValue(array $handles) {
if ($this->getProxy()) {
return $this->getProxy()->renderCommitMessageValue($handles);
}
throw new PhabricatorCustomFieldImplementationIncompleteException($this);
}
/**
* @task commitmessage
*/
public function validateCommitMessageValue($value) {
if ($this->getProxy()) {
return $this->getProxy()->validateCommitMessageValue($value);
}
return;
}
/* -( Integration with Diff Properties )----------------------------------- */ /* -( Integration with Diff Properties )----------------------------------- */

View file

@ -270,39 +270,6 @@ final class DifferentialJIRAIssuesField
$editor->save(); $editor->save();
} }
public function shouldAppearInCommitMessage() {
return true;
}
public function shouldAppearInCommitMessageTemplate() {
return true;
}
public function getCommitMessageLabels() {
return array(
'JIRA',
'JIRA Issues',
'JIRA Issue',
);
}
public function parseValueFromCommitMessage($value) {
return preg_split('/[\s,]+/', $value, $limit = -1, PREG_SPLIT_NO_EMPTY);
}
public function readValueFromCommitMessage($value) {
$this->setValue($value);
return $this;
}
public function renderCommitMessageValue(array $handles) {
$value = $this->getValue();
if (!$value) {
return null;
}
return implode(', ', $value);
}
public function shouldAppearInConduitDictionary() { public function shouldAppearInConduitDictionary() {
return true; return true;
} }

View file

@ -130,14 +130,6 @@ final class DifferentialRevertPlanField
return array($xaction->getNewValue()); return array($xaction->getNewValue());
} }
public function shouldAppearInCommitMessage() {
return true;
}
public function renderCommitMessageValue(array $handles) {
return $this->getValue();
}
public function shouldAppearInConduitDictionary() { public function shouldAppearInConduitDictionary() {
return true; return true;
} }

View file

@ -45,7 +45,7 @@ abstract class DifferentialCommitMessageCustomField
protected function getCustomFieldOrder($key) { protected function getCustomFieldOrder($key) {
$field_list = PhabricatorCustomField::getObjectFields( $field_list = PhabricatorCustomField::getObjectFields(
new DifferentialRevision(), new DifferentialRevision(),
DifferentialCustomField::ROLE_COMMITMESSAGE); PhabricatorCustomField::ROLE_DEFAULT);
$fields = $field_list->getFields(); $fields = $field_list->getFields();