From c2ebd1bb43d06223d26426a233c00a6ca22f45d6 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sun, 6 Jan 2008 08:52:17 +0000 Subject: Bug 355847: Make the WebService able to add a comment to a bug Patch By Tsahi Asher r=mkanat, a=mkanat --- contrib/bz_webservice_demo.pl | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/bz_webservice_demo.pl b/contrib/bz_webservice_demo.pl index 72dd78a19..72c8fdaa9 100755 --- a/contrib/bz_webservice_demo.pl +++ b/contrib/bz_webservice_demo.pl @@ -51,6 +51,9 @@ my $bug_id; my $product_name; my $create_file_name; my $legal_field_values; +my $add_comment; +my $private; +my $work_time; GetOptions('help|h|?' => \$help, 'uri=s' => \$Bugzilla_uri, @@ -60,7 +63,10 @@ GetOptions('help|h|?' => \$help, 'bug_id:s' => \$bug_id, 'product_name:s' => \$product_name, 'create:s' => \$create_file_name, - 'field:s' => \$legal_field_values + 'field:s' => \$legal_field_values, + 'comment:s' => \$add_comment, + 'private:i' => \$private, + 'worktime:f' => \$work_time ) or pod2usage({'-verbose' => 0, '-exitval' => 1}); =head1 OPTIONS @@ -88,7 +94,7 @@ Bugzilla password. Specify this together with B<--login> in order to log in. =item --rememberlogin -Gives access to Bugzilla's “Bugzilla_remember” option. +Gives access to Bugzilla's "Bugzilla_remember" option. Specify this option while logging in to do the same thing as ticking the C box on Bugilla's log in form. Don't specify this option to do the same thing as unchecking the box. @@ -114,6 +120,20 @@ Pass a field name to get legal values for this field. It must be either a global select field (such as bug_status, resolution, rep_platform, op_sys, priority, bug_severity) or a custom select field. +=item --comment + +A comment to add to a bug identified by B<--bug_id>. You must also pass a B<--login> +and B<--password> to log in to Bugzilla. + +=item --private + +An optional non-zero value to specify B<--comment> as private. + +=item --worktime + +An optional double precision number specifying the work time for B<--comment>. + + =back =head1 DESCRIPTION @@ -302,6 +322,25 @@ if ($legal_field_values) { print join("\n", @{$result->{values}}) . "\n"; } +=head2 Adding a comment to a bug + +Call C with the bug id, the comment text, and optionally the number +of hours you worked on the bug, and a boolean indicating if the comment is private +or not. + +=cut + +if ($add_comment) { + if ($bug_id) { + $soapresult = $proxy->call('Bug.add_comment', {id => $bug_id, + comment => $add_comment, private => $private, work_time => $work_time}); + _die_on_fault($soapresult); + print "Comment added.\n"; + } + else { + print "A --bug_id must be supplied to add a comment."; + } +} =head1 NOTES -- cgit v1.2.3-24-g4f1b