Mercurial > pub > buggler
view translate.pl @ 10:14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
author | cin |
---|---|
date | Mon, 07 Sep 2015 01:37:11 +0300 |
parents | cc7244ab1b9f |
children | 4eb9fdf4efa9 |
line wrap: on
line source
#!/usr/bin/perl -w use IMPL::require { BzClient => 'Benzin::Bugzilla::XmlRpcClient', BugWriter => 'Benzin::Bugzilla::XmlWriter' }; use YAML::XS qw(LoadFile Dump); use XML::Writer; use IPC::Run qw(start finish); my $config = LoadFile("config.yaml"); if ( !( $config->{bugzilla}{url} =~ /\/$/ ) ) { $config->{bugzilla}{url} .= "/"; } my $bz = BzClient->new( url => $config->{bugzilla}{url}, apikey => $config->{bugzilla}{apikey} ); my $bugs = $config->{bugzilla}{bugs} or die "No bugs specified"; $bugs = [$bugs] unless ref $bugs eq 'ARRAY'; local (*HIN); my $proc = start( [ 'saxon8', '-novw', '-', 'bug-list.xsl' ], #[ 'cat' ], '<pipe', \*HIN, '>', \*STDOUT ) or die "failed to create pipe: $!"; binmode *HIN, ":encoding(utf-8)"; my $writer = BugWriter->new( OUTPUT => *HIN, DATA_INDENT => 2, DATA_MODE => 'on' ); eval { my %visited; my $fetched = $bz->GetBugsHierarchy( { ids => [283] } ); $bz->PopulateBugsComments($fetched); $bz->PopulateBugsHistory($fetched); $writer->WriteBugList($fetched); }; warn Dump($@) and die $@ if $@; close HIN; finish($proc); 1;