mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Add Branch and Arcanist Project CustomFields
Summary: Ref T2222. These are pretty straightforward. For these fields and a few others, the existing code shows the value for the "current/manual" diff (i.e., the diff selected in the diff selection table), not the "active" diff (i.e., the most recent diff attached to the revision). I'm going to drop that for now (always showing the most recent diff instead) and then reevaluate it once we're switched over. In 95% of cases these are the same, anyway. Test Plan: Looked at fields; this diff changes nothing on its own. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D8359
This commit is contained in:
parent
37b1b31638
commit
0b4a6b8bee
3 changed files with 93 additions and 0 deletions
|
@ -324,6 +324,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php',
|
||||
'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php',
|
||||
'DifferentialApplyPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php',
|
||||
'DifferentialArcanistProjectField' => 'applications/differential/customfield/DifferentialArcanistProjectField.php',
|
||||
'DifferentialArcanistProjectFieldSpecification' => 'applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php',
|
||||
'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php',
|
||||
'DifferentialAsanaRepresentationFieldSpecification' => 'applications/differential/field/specification/DifferentialAsanaRepresentationFieldSpecification.php',
|
||||
|
@ -333,6 +334,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialAuxiliaryField' => 'applications/differential/storage/DifferentialAuxiliaryField.php',
|
||||
'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php',
|
||||
'DifferentialBlameRevisionFieldSpecification' => 'applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php',
|
||||
'DifferentialBranchField' => 'applications/differential/customfield/DifferentialBranchField.php',
|
||||
'DifferentialBranchFieldSpecification' => 'applications/differential/field/specification/DifferentialBranchFieldSpecification.php',
|
||||
'DifferentialCCWelcomeMail' => 'applications/differential/mail/DifferentialCCWelcomeMail.php',
|
||||
'DifferentialCCsFieldSpecification' => 'applications/differential/field/specification/DifferentialCCsFieldSpecification.php',
|
||||
|
@ -462,6 +464,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php',
|
||||
'DifferentialRevision' => 'applications/differential/storage/DifferentialRevision.php',
|
||||
'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php',
|
||||
'DifferentialRevisionDetailRenderer' => 'applications/differential/controller/DifferentialRevisionDetailRenderer.php',
|
||||
'DifferentialRevisionDetailView' => 'applications/differential/view/DifferentialRevisionDetailView.php',
|
||||
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
|
||||
'DifferentialRevisionEditControllerPro' => 'applications/differential/controller/DifferentialRevisionEditControllerPro.php',
|
||||
|
@ -2504,6 +2507,7 @@ phutil_register_library_map(array(
|
|||
'ReleephDiffChurnFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php',
|
||||
'ReleephDiffMessageFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php',
|
||||
'ReleephDiffSizeFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php',
|
||||
'ReleephDifferentialRevisionDetailRenderer' => 'applications/releeph/differential/ReleephDifferentialRevisionDetailRenderer.php',
|
||||
'ReleephFieldParseException' => 'applications/releeph/field/exception/ReleephFieldParseException.php',
|
||||
'ReleephFieldSelector' => 'applications/releeph/field/selector/ReleephFieldSelector.php',
|
||||
'ReleephFieldSpecification' => 'applications/releeph/field/specification/ReleephFieldSpecification.php',
|
||||
|
@ -2890,6 +2894,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialAffectedPath' => 'DifferentialDAO',
|
||||
'DifferentialApplyPatchField' => 'DifferentialCustomField',
|
||||
'DifferentialApplyPatchFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialArcanistProjectField' => 'DifferentialCustomField',
|
||||
'DifferentialArcanistProjectFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialAsanaRepresentationField' => 'DifferentialCustomField',
|
||||
'DifferentialAsanaRepresentationFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
|
@ -2898,6 +2903,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialAuthorFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField',
|
||||
'DifferentialBlameRevisionFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialBranchField' => 'DifferentialCustomField',
|
||||
'DifferentialBranchFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialCCWelcomeMail' => 'DifferentialReviewRequestMail',
|
||||
'DifferentialCCsFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
final class DifferentialArcanistProjectField
|
||||
extends DifferentialCustomField {
|
||||
|
||||
public function getFieldKey() {
|
||||
return 'differential:arcanist-project';
|
||||
}
|
||||
|
||||
public function getFieldName() {
|
||||
return pht('Arcanist Project');
|
||||
}
|
||||
|
||||
public function getFieldDescription() {
|
||||
return pht('Shows arcanist project name.');
|
||||
}
|
||||
|
||||
public function shouldAppearInPropertyView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function renderPropertyViewLabel() {
|
||||
return $this->getFieldName();
|
||||
}
|
||||
|
||||
public function getRequiredHandlePHIDsForPropertyView() {
|
||||
$phid = $this->getArcanistProjectPHID();
|
||||
if ($phid) {
|
||||
return array($phid);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
public function renderPropertyViewValue(array $handles) {
|
||||
return $this->renderHandleList($handles);
|
||||
}
|
||||
|
||||
private function getArcanistProjectPHID() {
|
||||
return $this->getObject()->getActiveDiff()->getArcanistProjectPHID();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
final class DifferentialBranchField
|
||||
extends DifferentialCustomField {
|
||||
|
||||
public function getFieldKey() {
|
||||
return 'differential:branch';
|
||||
}
|
||||
|
||||
public function getFieldName() {
|
||||
return pht('Branch');
|
||||
}
|
||||
|
||||
public function getFieldDescription() {
|
||||
return pht('Shows the branch a diff came from.');
|
||||
}
|
||||
|
||||
public function shouldAppearInPropertyView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function renderPropertyViewLabel() {
|
||||
return $this->getFieldName();
|
||||
}
|
||||
|
||||
public function renderPropertyViewValue(array $handles) {
|
||||
return $this->getBranchDescription($this->getObject()->getActiveDiff());
|
||||
}
|
||||
|
||||
private function getBranchDescription(DifferentialDiff $diff) {
|
||||
$branch = $diff->getBranch();
|
||||
$bookmark = $diff->getBookmark();
|
||||
|
||||
if (strlen($branch) && strlen($bookmark)) {
|
||||
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
|
||||
} else if (strlen($bookmark)) {
|
||||
return pht('%s (bookmark)', $bookmark);
|
||||
} else if (strlen($branch)) {
|
||||
return $branch;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue