mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Fix an unusual nonterminating task graph node
Summary: Fixes T12114. There were a couple of bugs here: - We could draw too many joining lines if a node had a parent with multiple descendants. - We could incorrectly ignore columns because of an `unset()`. I //think// this fixes both things without collateral damage. This whole thing is a little hard to understand/debug and has grown beyond its original scope, so I'll probably rewrite it if there are more issues. Test Plan: - Unit tests. - My local repro is clean now: {F2424920} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12114 Differential Revision: https://secure.phabricator.com/D17211
This commit is contained in:
parent
a4a9485612
commit
48187cdbbe
2 changed files with 30 additions and 7 deletions
|
@ -50,7 +50,6 @@ final class PHUIDiffGraphView extends Phobject {
|
|||
|
||||
$thread_count = $pos;
|
||||
for ($n = 0; $n < $thread_count; $n++) {
|
||||
|
||||
if (empty($threads[$n])) {
|
||||
$line .= ' ';
|
||||
continue;
|
||||
|
@ -60,7 +59,7 @@ final class PHUIDiffGraphView extends Phobject {
|
|||
if ($found) {
|
||||
$line .= ' ';
|
||||
$joins[] = $n;
|
||||
unset($threads[$n]);
|
||||
$threads[$n] = false;
|
||||
} else {
|
||||
$line .= 'o';
|
||||
$found = true;
|
||||
|
@ -114,6 +113,7 @@ final class PHUIDiffGraphView extends Phobject {
|
|||
if ($thread_commit == $parent) {
|
||||
$found = true;
|
||||
$splits[] = $idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ final class PHUIDiffGraphViewTestCase extends PhabricatorTestCase {
|
|||
'^',
|
||||
'|^',
|
||||
'o ',
|
||||
'|^',
|
||||
'||^',
|
||||
'o ',
|
||||
'x',
|
||||
'| ^',
|
||||
'| |^',
|
||||
'o ',
|
||||
'x ',
|
||||
);
|
||||
|
||||
$this->assertGraph($picture, $graph, pht('Reverse Tree'));
|
||||
|
@ -71,7 +71,30 @@ final class PHUIDiffGraphViewTestCase extends PhabricatorTestCase {
|
|||
'x ',
|
||||
);
|
||||
|
||||
$this->assertGraph($picture, $graph, pht('Reverse Tree'));
|
||||
$this->assertGraph($picture, $graph, pht('Terminated Tree'));
|
||||
}
|
||||
|
||||
public function testThreeWayGraphJoin() {
|
||||
$nodes = array(
|
||||
'A' => array('D', 'C', 'B'),
|
||||
'B' => array('D'),
|
||||
'C' => array('B', 'E', 'F'),
|
||||
'D' => array(),
|
||||
'E' => array(),
|
||||
'F' => array(),
|
||||
);
|
||||
|
||||
$graph = $this->newGraph($nodes);
|
||||
$picture = array(
|
||||
'^',
|
||||
'||o',
|
||||
'|o|',
|
||||
'x| ||',
|
||||
' | x|',
|
||||
' | x',
|
||||
);
|
||||
|
||||
$this->assertGraph($picture, $graph, pht('Three-Way Tree'));
|
||||
}
|
||||
|
||||
private function newGraph(array $nodes) {
|
||||
|
|
Loading…
Reference in a new issue