Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13998624
D16218.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16218.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -344,6 +344,7 @@
$stack_graph = id(new DifferentialRevisionGraph())
->setViewer($viewer)
->setSeedPHID($revision->getPHID())
+ ->setLoadEntireGraph(true)
->loadGraph();
if (!$stack_graph->isEmpty()) {
$stack_table = $stack_graph->newGraphTable();
diff --git a/src/infrastructure/graph/PhabricatorObjectGraph.php b/src/infrastructure/graph/PhabricatorObjectGraph.php
--- a/src/infrastructure/graph/PhabricatorObjectGraph.php
+++ b/src/infrastructure/graph/PhabricatorObjectGraph.php
@@ -5,8 +5,10 @@
private $viewer;
private $edges = array();
+ private $edgeReach = array();
private $seedPHID;
private $objects;
+ private $loadEntireGraph = false;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
@@ -29,6 +31,7 @@
final public function setSeedPHID($phid) {
$this->seedPHID = $phid;
+ $this->edgeReach[$phid] = array_fill_keys($this->getEdgeTypes(), true);
return $this->addNodes(
array(
@@ -41,7 +44,30 @@
}
final public function getEdges($type) {
- return idx($this->edges, $type, array());
+ $edges = idx($this->edges, $type, array());
+
+ // Remove any nodes which we never reached. We can get these when loading
+ // only part of the graph: for example, they point at other subtasks of
+ // parents or other parents of subtasks.
+ $nodes = $this->getNodes();
+ foreach ($edges as $src => $dsts) {
+ foreach ($dsts as $key => $dst) {
+ if (!isset($nodes[$dst])) {
+ unset($edges[$src][$key]);
+ }
+ }
+ }
+
+ return $edges;
+ }
+
+ final public function setLoadEntireGraph($load_entire_graph) {
+ $this->loadEntireGraph = $load_entire_graph;
+ return $this;
+ }
+
+ final public function getLoadEntireGraph() {
+ return $this->loadEntireGraph;
}
final protected function loadEdges(array $nodes) {
@@ -53,6 +79,8 @@
$query->execute();
+ $whole_graph = $this->getLoadEntireGraph();
+
$map = array();
foreach ($nodes as $node) {
$map[$node] = array();
@@ -64,7 +92,10 @@
$this->edges[$edge_type][$node] = $dst_phids;
foreach ($dst_phids as $dst_phid) {
- $map[$node][] = $dst_phid;
+ if ($whole_graph || isset($this->edgeReach[$node][$edge_type])) {
+ $map[$node][] = $dst_phid;
+ }
+ $this->edgeReach[$dst_phid][$edge_type] = true;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 25, 10:18 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6733499
Default Alt Text
D16218.diff (2 KB)
Attached To
Mode
D16218: Don't load the entire graph for tasks
Attached
Detach File
Event Timeline
Log In to Comment