|
Lines 1-5
Link Here
|
| 1 |
#!/usr/bin/env perl |
1 |
#!/usr/bin/env perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 2 |
use Modern::Perl; |
18 |
use Modern::Perl; |
|
|
19 |
|
| 3 |
use Term::ANSIColor qw(:constants); |
20 |
use Term::ANSIColor qw(:constants); |
| 4 |
use Git::Wrapper; |
21 |
use Git::Wrapper; |
| 5 |
use File::Slurp qw( write_file ); |
22 |
use File::Slurp qw( write_file ); |
|
Lines 7-16
use File::Temp qw( tempfile );
Link Here
|
| 7 |
use File::Basename qw(dirname); |
24 |
use File::Basename qw(dirname); |
| 8 |
use File::Path qw(make_path); |
25 |
use File::Path qw(make_path); |
| 9 |
use List::Util qw( first ); |
26 |
use List::Util qw( first ); |
|
|
27 |
use LWP::UserAgent (); |
| 10 |
use Getopt::Long; |
28 |
use Getopt::Long; |
| 11 |
use Pod::Usage; |
29 |
use Pod::Usage; |
| 12 |
use Try::Tiny; |
30 |
use Try::Tiny; |
| 13 |
use REST::Client; |
|
|
| 14 |
use JSON qw( decode_json ); |
31 |
use JSON qw( decode_json ); |
| 15 |
$Term::ANSIColor::AUTOLOCAL = 1; |
32 |
$Term::ANSIColor::AUTOLOCAL = 1; |
| 16 |
|
33 |
|
|
Lines 85-101
switch_branch($tmp_src_branch);
Link Here
|
| 85 |
|
102 |
|
| 86 |
if ($bug_number) { |
103 |
if ($bug_number) { |
| 87 |
say BLUE sprintf "Guessing a date to use from bugzilla's bug %s", $bug_number; |
104 |
say BLUE sprintf "Guessing a date to use from bugzilla's bug %s", $bug_number; |
| 88 |
my $client = REST::Client->new( |
105 |
my $client = LWP::UserAgent->new(); |
| 89 |
{ |
106 |
my $response = $client->get( 'https://bugs.koha-community.org/bugzilla3/rest' |
| 90 |
host => 'https://bugs.koha-community.org/bugzilla3/rest', |
107 |
. "/bug/$bug_number/attachment?include_fields=is_patch,is_obsolete,creation_time,summary" ); |
| 91 |
} |
108 |
|
| 92 |
); |
109 |
if ( !$response->is_success ) { |
|
|
110 |
say RED sprintf "Request to Bugzilla returned an error: %s", $response->status_line; |
| 111 |
exit 2; |
| 112 |
} |
| 93 |
|
113 |
|
| 94 |
$client->GET("/bug/$bug_number/attachment?include_fields=is_patch,is_obsolete,creation_time,summary"); |
114 |
my $bz_response = decode_json( $response->decoded_content ); |
| 95 |
my $response = decode_json( $client->responseContent ); |
|
|
| 96 |
|
115 |
|
| 97 |
my $time; |
116 |
my $time; |
| 98 |
foreach my $attachment ( @{ $response->{bugs}->{$bug_number} } ) { |
117 |
foreach my $attachment ( @{ $bz_response->{bugs}->{$bug_number} } ) { |
| 99 |
next if ( $attachment->{is_obsolete} ); |
118 |
next if ( $attachment->{is_obsolete} ); |
| 100 |
next if ( !$attachment->{is_patch} ); |
119 |
next if ( !$attachment->{is_patch} ); |
| 101 |
|
120 |
|
| 102 |
- |
|
|