Page MenuHomePhabricator

D16352.diff
No OneTemporary

D16352.diff

diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php
@@ -178,6 +178,7 @@
$results = array();
foreach ($field_lists as $revision_phid => $field_list) {
+ $results[$revision_phid] = array();
foreach ($field_list->getFields() as $field) {
$field_key = $field->getFieldKeyForConduit();
$value = $field->getConduitDictionaryValue();
@@ -185,6 +186,32 @@
}
}
+ // For compatibility, fill in these "custom fields" by querying for them
+ // efficiently. See T11404 for discussion.
+
+ $legacy_edge_map = array(
+ 'phabricator:projects' =>
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
+ 'phabricator:depends-on' =>
+ DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST,
+ );
+
+ $query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs(array_keys($results))
+ ->withEdgeTypes($legacy_edge_map);
+
+ $query->execute();
+
+ foreach ($results as $revision_phid => $dict) {
+ foreach ($legacy_edge_map as $edge_key => $edge_type) {
+ $phid_list = $query->getDestinationPHIDs(
+ array($revision_phid),
+ array($edge_type));
+
+ $results[$revision_phid][$edge_key] = $phid_list;
+ }
+ }
+
return $results;
}
diff --git a/src/applications/differential/customfield/DifferentialParentRevisionsField.php b/src/applications/differential/customfield/DifferentialParentRevisionsField.php
--- a/src/applications/differential/customfield/DifferentialParentRevisionsField.php
+++ b/src/applications/differential/customfield/DifferentialParentRevisionsField.php
@@ -7,10 +7,6 @@
return 'differential:depends-on';
}
- public function getFieldKeyForConduit() {
- return 'phabricator:depends-on';
- }
-
public function getFieldName() {
return pht('Parent Revisions');
}
@@ -33,7 +29,10 @@
}
public function shouldAppearInConduitDictionary() {
- return true;
+ // To improve performance, we exclude this field from Conduit results.
+ // See T11404 for discussion. In modern "differential.revision.search",
+ // this information is available efficiently as an attachment.
+ return false;
}
public function getConduitDictionaryValue() {
diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php
--- a/src/applications/differential/customfield/DifferentialProjectsField.php
+++ b/src/applications/differential/customfield/DifferentialProjectsField.php
@@ -91,7 +91,10 @@
}
public function shouldAppearInConduitDictionary() {
- return true;
+ // To improve performance, we exclude this field from Conduit results.
+ // See T11404 for discussion. In modern "differential.revision.search",
+ // this information is available efficiently as an attachment.
+ return false;
}
public function getApplicationTransactionMetadata() {

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 3:24 AM (18 h, 5 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6909375
Default Alt Text
D16352.diff (3 KB)

Event Timeline