Skip to content

Commit b792947

Browse files
author
gerv%gerv.net
committed
Bug 30480 - add 'show dependencies as buglist' links. Patch by gerv, r=myk, kiko.
1 parent 17ced4d commit b792947

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

webtools/bugzilla/showdependencytree.cgi

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ use strict;
2828
use lib qw(.);
2929
require "CGI.pl";
3030

31-
# Shut up misguided -w warnings about "used only once":
32-
3331
use vars %::FORM;
3432

3533
ConnectToDatabase();
@@ -63,6 +61,9 @@ if ($hide_resolved !~ /^\d+$/ || $hide_resolved != 1) { $hide_resolved = 0 };
6361
# A hash to count visited bugs, and also to avoid processing repeated bugs
6462
my %seen;
6563

64+
# A hash to keep track of the bugs we print for the 'as buglist' links.
65+
my %printed;
66+
6667
# HTML output generated in the parse of the dependency tree. This is a
6768
# global only to avoid excessive complication in the recursion invocation
6869
my $html;
@@ -92,6 +93,7 @@ my $scriptname = $::ENV{'SCRIPT_NAME'}; # showdependencytree.cgi
9293
# html: Bug descriptions are appended here
9394
# realdepth: We set the maximum depth of recursion reached
9495
# seen: We store the bugs analyzed so far
96+
# printed: We store those bugs we actually print, for the "buglist" link
9597
# Globals Referenced
9698
# maxdepth
9799
# hide_resolved
@@ -161,6 +163,8 @@ sub DumpKids {
161163
$short_desc.</a>\n|;
162164
}
163165
if (! $opened) { $html .= "</span></strike>"; }
166+
167+
$printed{$kid} = 1;
164168
} # End hideable output
165169

166170
# Store the maximum depth so far
@@ -197,6 +201,7 @@ sub makeTreeHTML {
197201
# Clean up globals for this run
198202
$html = "";
199203
%seen = ();
204+
%printed = ();
200205

201206
DumpKids($i, $target);
202207
my $tmphtml = $html;
@@ -205,6 +210,11 @@ sub makeTreeHTML {
205210
$html = "<h3>Bugs that bug $linked_id ".($target eq "blocked" ?
206211
"blocks" : "depends on");
207212

213+
if ((scalar keys %printed) > 0) {
214+
$html .= ' (<a href="buglist.cgi?bug_id=' . join(',', keys %printed) .
215+
'">view as bug list</a>)';
216+
}
217+
208218
# Provide feedback for omitted bugs
209219
if ($maxdepth || $hide_resolved) {
210220
$html .= " <small><b>(Only ";
@@ -218,7 +228,7 @@ sub makeTreeHTML {
218228
$html .= $tmphtml;
219229

220230
# If no bugs were found, say so
221-
if ((scalar keys %seen) < 2) {
231+
if ((scalar keys %printed) == 0) {
222232
$html .= "&nbsp;&nbsp;&nbsp;&nbsp;None<p>\n";
223233
}
224234

@@ -296,7 +306,7 @@ sub drawDepForm {
296306
<form method="get" action="$scriptname"
297307
style="display: inline; margin: 0px;">
298308
299-
<!-- Limit entry form: the button can't do anything when total depth
309+
<!-- Limit entry form: the button can not do anything when total depth
300310
is less than two, so disable it -->
301311
<input name="maxdepth" size="4" maxlength="4" value="|
302312
. ( $maxdepth > 0 ? $maxdepth : "" ) . qq|">

0 commit comments

Comments
 (0)