diff -r -u -N /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/bug_form.pl ./bug_form.pl --- /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/bug_form.pl Fri Nov 1 11:11:22 2002 +++ ./bug_form.pl Fri Nov 1 11:10:50 2002 @@ -28,6 +28,167 @@ # Use the Attachment module to display attachments for the bug. use Attachment; +# Prepare a hash for the section of the bug form showing information +# replicated from the Perforce source code management system by the +# P4DTI replicator. Derived from code contributed by Matt Albrecht +# . + +sub PreparePerforceSection { + my ($bug_id) = (@_); + my $jobname; + my %p4dti; + $p4dti{'hasp4dti'} = 0; + if (Param("p4dti")) { + $p4dti{'hasp4dti'} = 1; + + # First get the row from p4dti_bugs showing whether or not this bug is + # replicated at all. + SendSQL("SELECT rid, sid, jobname FROM p4dti_bugs " . + "WHERE bug_id = $bug_id"); + if (!MoreSQLData()) { + $p4dti{'isreplicated'} = 0; + } else { + $p4dti{'isreplicated'} = 1; + + ($p4dti{'rid'}, $p4dti{'sid'}, $jobname) = + (FetchSQLData()); + + # Replicating a bug more than once (i.e. to more than one + # Perforce server or via more than one replicator) is + # currently not supported by the replication system. + if (MoreSQLData()) { + my ($other_rid, $other_sid) = (FetchSQLData()); + die "bug $bug_id is replicated by (".$p4dti{'rid'}.", ". + $p4dti{'sid'}.") and ($other_rid, $other_sid)."; + } + + # Get P4DTI config for this rid/sid combination + my %p4dti_config; + SendSQL("SELECT config_key, config_value FROM p4dti_config " . + "WHERE rid = " . SqlQuote($p4dti{'rid'}) . " AND sid = " . + SqlQuote($p4dti{'sid'})); + while(MoreSQLData()) { + my ($p4dti_config_key, $p4dti_config_value) = FetchSQLData(); + $p4dti_config{$p4dti_config_key} = $p4dti_config_value; + } + if (!defined $p4dti_config{'p4_server_description'}) { + $p4dti_config{'p4_server_description'} = ""; + } + if (!defined $p4dti_config{'changelist_url'}) { + $p4dti_config{'changelist_url'} = ""; + } + if (!defined $p4dti_config{'job_url'}) { + $p4dti_config{'job_url'} = ""; + } + if (!defined $p4dti_config{'replicator_user'}) { + $p4dti_config{'replicator_user'} = ""; + } + $p4dti{'config'} = \%p4dti_config; + + $jobname = value_quote($jobname); + if ($p4dti_config{"job_url"} ne "") { + $p4dti{'jobname'} = sprintf("$jobname", $jobname); + } else { # no job URL pattern. + $p4dti{'jobname'} = $jobname; + } + + # Get actual fixes. + # Every row in the p4dti_fixes table with the right bug_id + # is a fix for this bug. We have to match that up with a row + # in the p4dti_changelist table, to get the fix description. + # However, if there are multiple replicators running, + # there may be more than one row in the p4dti_changelist + # table with a given changelist number. So we make + # the SIDs (Perforce server IDs) match. + # + # We do a LEFT JOIN and get a not-NULL field (the rid) + # from the p4dti_changelists table so we can distinguish + # the cases in which there is not a p4dti_changelists row + # for this changelist. That indicates a failure in the + # replicator, so we want to know about it. + SendSQL("SELECT profiles.realname, profiles.login_name, " . + " p4dti_fixes.changelist, " . + " p4dti_fixes.status, p4dti_changelists.p4date, " . + " p4dti_changelists.description, p4dti_changelists.rid, " . + " p4dti_changelists.flags " . + "FROM p4dti_fixes, profiles " . + "LEFT JOIN p4dti_changelists " . + " ON (p4dti_changelists.changelist=p4dti_fixes.changelist" . + " AND p4dti_changelists.sid = p4dti_fixes.sid)" . + "WHERE p4dti_fixes.bug_id = $bug_id " . + " AND profiles.userid = p4dti_fixes.user " . + " AND p4dti_fixes.rid = ". SqlQuote($p4dti{'rid'}) . + " AND p4dti_changelists.rid = ". SqlQuote($p4dti{'rid'}) . + " AND p4dti_fixes.sid = ". SqlQuote($p4dti{'sid'}) . + " AND p4dti_changelists.sid = ". SqlQuote($p4dti{'sid'}) . + " ORDER BY p4dti_fixes.changelist"); + if (MoreSQLData()) { + $p4dti{'hasfixes'} = 1; + my @fixlist; + while (MoreSQLData()) { + my %myset; + my ($realname, $login_name, $changelist, $status, $p4date, + $description, $changelist_rid, $changelist_flags) = + (FetchSQLData()); + if (!defined $changelist_rid || $changelist_rid eq "") { + die "p4dti_changelists has no row for changelist $changelist."; + } + $myset{'changelist_rid'} = $changelist_rid; + $myset{'description'} = $description || "(none)"; + if ($changelist) { + my $changelist_html; + if ($p4dti_config{"changelist_url"} ne "") { + $myset{'changelist'} = + sprintf("$changelist", + $changelist); + } else { # no changelist URL pattern. + $myset{'changelist'} = $changelist; + } + } else { + $myset{'changelist'} = ""; + } + if ($changelist_flags & 1) { + $myset{'changelist_note'} = ""; + } else { + $myset{'changelist_note'} = "(pending)"; + } + if ($login_name eq $p4dti_config{"replicator_user"}) { + $myset{'user_field'} = "(unknown)"; + } else { + $myset{'user_field'} = ("" . + value_quote($realname) . ""); + } + $myset{'status'} = $status || ""; + $myset{'p4date'} = $p4date || ""; + + push( @fixlist, \%myset ); + } + $p4dti{'fixes'} = \@fixlist; + } else { + $p4dti{'hasfixes'} = 0; + } + # get filespecs. + SendSQL("SELECT filespec " . + "FROM p4dti_filespecs " . + "WHERE bug_id = $bug_id"); + if (MoreSQLData()) { + $p4dti{'hasfilespecs'} = 1; + my @speclist; + while (MoreSQLData()) { + my ($filespec) = (FetchSQLData()); + push( @speclist, $filespec ); + } + $p4dti{'filespecs'} = \@speclist; + } else { + $p4dti{'hasfilespecs'} = 0; + } + } + } + return \%p4dti; +} + + + sub show_bug { # Shut up misguided -w warnings about "used only once". For some reason, # "use vars" chokes on me when I try it here. @@ -313,6 +474,8 @@ # Add the bug and user hashes to the variables $vars->{'bug'} = \%bug; $vars->{'user'} = \%user; + + $vars->{'p4dti'} = PreparePerforceSection($bug{'bug_id'}); # Create the elements for browsing bug lists $vars->{'navigation_links'} = navigation_links(join(':',@bug_list)); diff -r -u -N /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/defparams.pl ./defparams.pl --- /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/defparams.pl Fri Nov 1 11:11:22 2002 +++ ./defparams.pl Fri Nov 1 11:10:50 2002 @@ -607,4 +607,9 @@ "t" , '1000'); +DefParam("p4dti", + "If this is on, Bugzilla uses the Perforce Defect Tracking Integration.", + "b", + 0); + 1; diff -r -u -N /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/doeditparams.cgi ./doeditparams.cgi --- /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/doeditparams.cgi Fri Nov 1 11:11:23 2002 +++ ./doeditparams.cgi Fri Nov 1 11:10:51 2002 @@ -26,6 +26,7 @@ use lib qw(.); require "CGI.pl"; +require "globals.pl"; require "defparams.pl"; # Shut up misguided -w warnings about "used only once": @@ -74,6 +75,41 @@ } +#### +# ndl@ravenbrook.com 2001-11-23: +# If the parameters table did not exist, create and populate it. +# If a parameters table is incorporated into the main Bugzilla sources +# then it should be created and initially populated from this +# checksetup.pl, and merely updated in this file. + +SendSQL ("SHOW TABLES LIKE 'p4dti_bugzilla_parameters'"); +if (MoreSQLData()) { + print("Updating table p4dti_bugzilla_parameters.
\n"); +} else { + print("Creating table p4dti_bugzilla_parameters.
\n"); + SendSQL("CREATE TABLE p4dti_bugzilla_parameters + (parameter_name varchar(255) not null primary key, + parameter_value mediumtext)"); +} + +foreach my $i (@::param_list) { + my $val = SqlQuote($::param{$i}); + SendSQL("SELECT parameter_value + FROM p4dti_bugzilla_parameters + WHERE parameter_name = '$i'"); + if (MoreSQLData()) { + SendSQL("UPDATE p4dti_bugzilla_parameters + SET parameter_value = $val + WHERE parameter_name = '$i'"); + } else { + SendSQL("INSERT INTO p4dti_bugzilla_parameters + VALUES ('$i', $val)"); + } +} + +# +#### + WriteParams(); unlink "data/versioncache"; diff -r -u -N /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/template/en/custom/bug/edit.html.tmpl ./template/en/custom/bug/edit.html.tmpl --- /home/nb/info.ravenbrook.com/project/p4dti/import/2002-09-30/bugzilla-2.16.1/bugzilla-2.16.1/template/en/custom/bug/edit.html.tmpl Thu Jan 1 01:00:00 1970 +++ ./template/en/custom/bug/edit.html.tmpl Fri Nov 1 11:10:51 2002 @@ -0,0 +1,624 @@ + +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Gervase Markham + #%] + +[% filtered_desc = bug.short_desc FILTER html %] +[% UNLESS header_done %] + [% PROCESS global/header.html.tmpl + title = "Bug $bug.bug_id - $bug.short_desc" + h1 = "Bugzilla Bug $bug.bug_id" + h2 = filtered_desc + header_html = navigation_links + %] +[% END %] + +[% PROCESS bug/navigate.html.tmpl %] + +
+ +
+ + + + + +[%# *** Platform Reporter Product OS AddCC *** %] + + + + + + + + + + [% PROCESS select selname = "rep_platform" %] + + + + + + + + [% PROCESS select selname => "product" %] + + + [% PROCESS select selname => "op_sys" %] + + + + + +[%# *** Component Version CC Priority Severity AssignedTo Milestone *** %] + + + + + + + + + [% PROCESS select selname => "version" %] + + + + + + + + + + + + [% PROCESS select selname => "priority" %] + + + + + + + + + [% PROCESS select selname = "bug_severity" %] + + + + + + + + + [% IF Param("usetargetmilestone") && bug.target_milestone %] + + [% PROCESS select selname = "target_milestone" %] + [% ELSE %] + + [% END %] + + +[%# *** QAContact URL Summary Whiteboard Keywords *** %] + + [% IF Param('useqacontact') %] + + + + + [% END %] + + + + + + + + + + + + [% IF Param('usestatuswhiteboard') %] + + + + + [% END %] + + [% IF use_keywords %] + + + + [% END %] +
+ Bug#: + + + [% bug.bug_id %] +   + Platform: + + Reporter: + + [% bug.reporter FILTER html %] +
+ Product: + + OS: + + Add CC: + + +
+ + + Component: + + + +   + Version: + + CC: + + [% IF bug.cc %] + +
+ Remove selected CCs +
+ [% ELSE %] + + [% END %] +
+ + Status: + + [% bug.bug_status FILTER html %]  + Priority: +
+ + Resolution: + + [% bug.resolution FILTER html %]  + Severity: +
+ + Assigned To: + + [% bug.assigned_to FILTER html %]  + + Target Milestone: + +  
+ QA Contact: + + +
+ + [% IF bug.bug_file_loc %] + URL: + [% ELSE %] + URL: + [% END %] + + + +
+ Summary: + + +
+ Status Whiteboard: + + +
+ + Keywords: + + + +
+ +[%# *** Attachments *** %] + + [% PROCESS attachment/list.html.tmpl + attachments = bug.attachments + bugid = bug.bug_id %] + +[%# *** Dependencies Votes *** %] + + [% IF Param('usedependencies') %] + + + [% PROCESS dependencies + dep = { title => "depends on", fieldname => "dependson" } %] + + + + + [% PROCESS dependencies + dep = { title => "blocks", fieldname => "blocked" } %] + +
+ Show + dependency tree + + [% IF Param('webdotbase') %] +
+ Show + dependency graph + [% END %] +
+ [% END %] + + [% IF use_votes %] + + + + + +
+ Votes: + + [% bug.votes %]    + Show + votes for this bug    + Vote + for this bug +
+ [% END %] + +[%# *** Comments Groups *** %] + +
+ Additional Comments: +
+ +
+ + [% IF groups.size > 0 %] +
+ Only users in all of the selected groups can view this bug: +
+ (Unchecking all boxes makes this a public bug.) +
+
+ + [% FOREACH group = groups %] +      + + [% group.description %] +
+ [% END %] + + [% IF NOT user.inallgroups %] + + Only members of a group can change the visibility of a bug for + that group + +
+ [% END %] + + [% IF bug.inagroup %] +

+ But users in the roles selected below can always view this bug: +
+ + (The assignee + [% IF (Param('useqacontact')) %] + and QA contact + [% END %] + can always see a bug, and this section does not take effect unless + the bug is restricted to at least one group.) + +

+ +

+ Reporter + CC List +

+ [% END %] + [% END %] + +[%# *** Knob *** %] + +
+ + Leave as [% bug.bug_status FILTER html %]  + [% bug.resolution FILTER html %] +
+ + [% knum = 1 %] + + [% IF bug.bug_status == "UNCONFIRMED" && + user.canconfirm %] + + Confirm bug (change status to NEW) +
+ [% knum = knum + 1 %] + [% END %] + + [% IF user.canedit %] + [% IF bug.isopened %] + [% IF bug.bug_status != "ASSIGNED" && user.canconfirm %] + + Accept bug ( + [% "confirm bug, " IF bug.isunconfirmed %]change + status to ASSIGNED) +
+ [% knum = knum + 1 %] + [% END %] + + [% IF bug.resolution %] + + Clear the resolution (remove the current resolution of + [% bug.resolution FILTER html %])
+ [% knum = knum + 1 %] + [% END %] + + + Resolve bug, changing resolution to + +
+ [% knum = knum + 1 %] + + + Resolve bug, mark it as duplicate of bug # + +
+ [% knum = knum + 1 %] + + + Reassign bug to + +
+ [% IF bug.isunconfirmed && user.canconfirm %] +      + and confirm bug (change status to NEW) +
+ [% END %] + [% knum = knum + 1 %] + + + Reassign bug to owner + [% "and QA contact" IF useqacontact %] + of selected component +
+ [% IF bug.isunconfirmed && user.canconfirm %] +      + and confirm bug (change status to NEW) +
+ [% END %] + [% knum = knum + 1 %] + [% ELSE %] + [% IF bug.resolution != "MOVED" || + (bug.resolution == "MOVED" && user.canmove) %] + Reopen bug +
+ [% knum = knum + 1 %] + [% END %] + [% IF bug.bug_status == "RESOLVED" %] + + Mark bug as VERIFIED
+ [% knum = knum + 1 %] + [% END %] + [% IF bug.bug_status != "CLOSED" %] + + Mark bug as CLOSED
+ [% knum = knum + 1 %] + [% END %] + [% END %] + [% END %] + + + +

+ + + View Bug Activity +   |   + Format For Printing + + + + [% IF user.canmove %] +   |   + + [% END %] +

+
+ +[%# *** Additional Comments *** %] + + + + + + +
+ + Description: + + + Opened: [% bug.creation_ts %] +
+
+ +[% PROCESS bug/comments.html.tmpl + comments = bug.comments + %] + +
+ +[%# P4DTI section. Derived in part from code contributed by Matt + # Albrecht . + #%] +[% IF p4dti.hasp4dti %] +
+ + [% IF p4dti.isreplicated %] + +

Perforce replication:

+ + + + + + + + + + + + + + + + + + + + + +
Job [% p4dti.jobname %]
Server + [% p4dti.sid FILTER html %] + [% IF p4dti.config.p4_server_description %]: + [% p4dti.config.p4_server_description FILTER html %] + [% END %] +
Replicator ID[% p4dti.rid FILTER html %]
Fixes + [% IF p4dti.hasfixes %] + + + + + + + + + [% FOREACH fix = p4dti.fixes %] + + + + + + + + [% END %] +
ChangeEffectDateUserDescription
[% fix.changelist %] + [% fix.changelist_note %][% fix.status FILTER html %][% fix.p4date FILTER html %][% fix.user_field %][% fix.description FILTER html %]
+ [% ELSE %] + None. + [% END %] +
Filespecs + [% IF p4dti.hasfilespecs %] + + [% FOREACH f = p4dti.filespecs %] + + + + [% END %] +
[% f FILTER html %]
+ [% ELSE %] + None. + [% END %] +
+ + [% ELSE %] + +

Not replicated in Perforce.

+ + [% END %] +
+
+[% END %] + +
+ +[% PROCESS bug/navigate.html.tmpl %] + +
+ +[% PROCESS global/footer.html.tmpl %] + + +[%############################################################################%] +[%# Block for dependencies #%] +[%############################################################################%] + +[% BLOCK dependencies %] + Bug [% bug.bug_id %] [%+ dep.title %]: + + [% FOREACH depbug = bug.${dep.fieldname} %] + [% GetBugLink(depbug, depbug) %][% " " %] + [% END %] + + + + +[% END %] + + +[%############################################################################%] +[%# Block for SELECT fields #%] +[%############################################################################%] + +[% BLOCK select %] + + + +   +[% END %]