Mercurial > pub > buggler
annotate translate.pl @ 11:4eb9fdf4efa9
refactoring, non-working bookings
author | cin |
---|---|
date | Mon, 07 Sep 2015 19:18:21 +0300 |
parents | 14a966369278 |
children | 52b34ea50eff |
rev | line source |
---|---|
0 | 1 #!/usr/bin/perl -w |
2 | |
9 | 3 use IMPL::require { |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
4 BzClient => 'Benzin::Bugzilla::XmlRpcClient', |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
5 BugWriter => 'Benzin::Bugzilla::XmlWriter' |
9 | 6 }; |
5 | 7 use YAML::XS qw(LoadFile Dump); |
8 use XML::Writer; | |
6 | 9 use IPC::Run qw(start finish); |
5 | 10 |
11 my $config = LoadFile("config.yaml"); | |
12 | |
13 if ( !( $config->{bugzilla}{url} =~ /\/$/ ) ) { | |
14 $config->{bugzilla}{url} .= "/"; | |
15 } | |
16 | |
9 | 17 my $bz = BzClient->new( |
5 | 18 url => $config->{bugzilla}{url}, |
19 apikey => $config->{bugzilla}{apikey} | |
20 ); | |
21 | |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
22 my $bugs = $config->{bugzilla}{bugs} or die "No bugs specified"; |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
23 $bugs = [$bugs] unless ref $bugs eq 'ARRAY'; |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
24 |
6 | 25 local (*HIN); |
26 | |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
27 my $proc = start( |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
28 [ 'saxon8', '-novw', '-', 'bug-list.xsl' ], |
11 | 29 |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
30 #[ 'cat' ], |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
31 '<pipe', \*HIN, '>', \*STDOUT |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
32 ) or die "failed to create pipe: $!"; |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
33 |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
34 binmode *HIN, ":encoding(utf-8)"; |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
35 my $writer = |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
36 BugWriter->new( OUTPUT => *HIN, DATA_INDENT => 2, DATA_MODE => 'on' ); |
11 | 37 $writer->timereports('on'); |
38 $writer->timeresolution(0.25); | |
6 | 39 |
9 | 40 eval { |
41 my %visited; | |
6 | 42 |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
43 my $fetched = $bz->GetBugsHierarchy( { ids => [283] } ); |
6 | 44 |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
45 $bz->PopulateBugsComments($fetched); |
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
46 $bz->PopulateBugsHistory($fetched); |
6 | 47 |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
9
diff
changeset
|
48 $writer->WriteBugList($fetched); |
5 | 49 |
9 | 50 }; |
51 warn Dump($@) and die $@ if $@; | |
5 | 52 |
6 | 53 close HIN; |
54 finish($proc); | |
5 | 55 |
9 | 56 1; |