diff options
author | lpsolit%gmail.com <> | 2007-04-07 16:18:02 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2007-04-07 16:18:02 +0000 |
commit | 49ac4e07d266ab55285e6c497cab5d17c56e8fcf (patch) | |
tree | ae498e7b437fb2acf727143eb840dc116248ffd7 /showdependencygraph.cgi | |
parent | b1710c8f53ed757f1c06e84e4c2790832232c58f (diff) | |
download | bugs-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.tar bugs-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.tar.gz bugs-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.tar.bz2 bugs-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.tar.xz bugs-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.zip |
Bug 102622: Dependency graphs should be able to be limited by "relationship" - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=LpSolit
Diffstat (limited to 'showdependencygraph.cgi')
-rwxr-xr-x | showdependencygraph.cgi | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi index 77259182f..92b6bd450 100755 --- a/showdependencygraph.cgi +++ b/showdependencygraph.cgi @@ -106,9 +106,10 @@ if (lsearch(\@valid_rankdirs, $rankdir) < 0) { $rankdir = 'LR'; } +my $display = $cgi->param('display') || 'tree'; my $webdotdir = bz_locations()->{'webdotdir'}; -if (!defined $cgi->param('id') && !defined $cgi->param('doall')) { +if (!defined $cgi->param('id') && $display ne 'doall') { ThrowCodeError("missing_bug_id"); } @@ -125,7 +126,7 @@ node [URL="${urlbase}show_bug.cgi?id=\\N", style=filled, color=lightgrey] my %baselist; -if ($cgi->param('doall')) { +if ($display eq 'doall') { my $dependencies = $dbh->selectall_arrayref( "SELECT blocked, dependson FROM dependencies"); @@ -135,29 +136,48 @@ if ($cgi->param('doall')) { } } else { foreach my $i (split('[\s,]+', $cgi->param('id'))) { - $i = trim($i); ValidateBugID($i); $baselist{$i} = 1; } my @stack = keys(%baselist); - my $sth = $dbh->prepare( - q{SELECT blocked, dependson - FROM dependencies - WHERE blocked = ? or dependson = ?}); - foreach my $id (@stack) { - my $dependencies = $dbh->selectall_arrayref($sth, undef, ($id, $id)); - foreach my $dependency (@$dependencies) { - my ($blocked, $dependson) = @$dependency; - if ($blocked != $id && !exists $seen{$blocked}) { - push @stack, $blocked; - } - if ($dependson != $id && !exists $seen{$dependson}) { - push @stack, $dependson; + if ($display eq 'web') { + my $sth = $dbh->prepare(q{SELECT blocked, dependson + FROM dependencies + WHERE blocked = ? OR dependson = ?}); + + foreach my $id (@stack) { + my $dependencies = $dbh->selectall_arrayref($sth, undef, ($id, $id)); + foreach my $dependency (@$dependencies) { + my ($blocked, $dependson) = @$dependency; + if ($blocked != $id && !exists $seen{$blocked}) { + push @stack, $blocked; + } + if ($dependson != $id && !exists $seen{$dependson}) { + push @stack, $dependson; + } + AddLink($blocked, $dependson, $fh); + } + } + } + # This is the default: a tree instead of a spider web. + else { + my @blocker_stack = @stack; + foreach my $id (@blocker_stack) { + my $blocker_ids = Bugzilla::Bug::EmitDependList('blocked', 'dependson', $id); + foreach my $blocker_id (@$blocker_ids) { + push(@blocker_stack, $blocker_id) unless $seen{$blocker_id}; + AddLink($id, $blocker_id, $fh); + } + } + my @dependent_stack = @stack; + foreach my $id (@dependent_stack) { + my $dep_bug_ids = Bugzilla::Bug::EmitDependList('dependson', 'blocked', $id); + foreach my $dep_bug_id (@$dep_bug_ids) { + push(@dependent_stack, $dep_bug_id) unless $seen{$dep_bug_id}; + AddLink($dep_bug_id, $id, $fh); } - - AddLink($blocked, $dependson, $fh); } } @@ -294,7 +314,7 @@ foreach my $f (@files) my @bugs = grep(detaint_natural($_), split(/[\s,]+/, $cgi->param('id'))); $vars->{'bug_id'} = join(', ', @bugs); $vars->{'multiple_bugs'} = ($cgi->param('id') =~ /[ ,]/); -$vars->{'doall'} = $cgi->param('doall'); +$vars->{'display'} = $display; $vars->{'rankdir'} = $rankdir; $vars->{'showsummary'} = $cgi->param('showsummary'); |