mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
converter for CHANGESTODO to csv import for into bug management tool
This commit is contained in:
parent
d6498a188a
commit
597204464d
4 changed files with 195 additions and 133 deletions
100
bin/todo2csv
Executable file
100
bin/todo2csv
Executable file
|
@ -0,0 +1,100 @@
|
|||
#!/usr/bin/perl
|
||||
# parse the historic CHANGESTODO.txt file and produce
|
||||
# a csv according to csv2trac format:
|
||||
#
|
||||
# 12 Each line in the CSV file needs to have the following entries
|
||||
# 13 type text -- the ticket purpose
|
||||
# 14 time integer -- the time it was created
|
||||
# 15 changetime integer
|
||||
# 16 component text
|
||||
# 17 severity text
|
||||
# 18 priority text
|
||||
# 19 owner text -- who is this ticket assigned to
|
||||
# 20 reporter text
|
||||
# 21 cc text -- email addresses to notify
|
||||
# 22 url text -- url related to this ticket
|
||||
# 23 version text --
|
||||
# 24 milestone text --
|
||||
# 25 status text
|
||||
# 26 resolution text
|
||||
# 27 summary text -- one-line summary
|
||||
# 28 description text -- problem description (long)
|
||||
# 29 keywords text
|
||||
|
||||
use locale;
|
||||
|
||||
my $changestodofile = shift or die 'Please provide path to CHANGESTODO.txt';
|
||||
open(I, "/usr/bin/expand $changestodofile |")
|
||||
or die "Failed to /usr/bin/expand $changestodofile";
|
||||
|
||||
print <<X;
|
||||
type\ttime\tchangetime\tcomponent\tseverity\tpriority\towner\treporter\tcc\turl\tversion\tmilestone\tstatus\tresolution\tsummary\tdescription\tkeywords
|
||||
X
|
||||
|
||||
my $text = '';
|
||||
my $headline, $first, $type, $sub;
|
||||
|
||||
my %types = (
|
||||
'-' => 'defect',
|
||||
'+' => 'enhancement',
|
||||
'*' => 'task',
|
||||
'?' => 'question', # needs to be added by trac-admin
|
||||
);
|
||||
|
||||
sub output {
|
||||
return unless $first;
|
||||
my $t = $types{$type};
|
||||
die 'no type' unless $t;
|
||||
$summary = ($first && $sub) ? "$sub: $first" : ($first || $sub);
|
||||
die 'expand failed' if $summary =~ /\t/ or $text =~ /\t/;
|
||||
# $summary =~ s/\t/ /gm;
|
||||
# $text =~ s/\t/ /gm;
|
||||
$text =~ s/\n/\\n/gm;
|
||||
my $mytime = 1234567890;
|
||||
print <<X;
|
||||
$t\t$mytime\t\tpsyced\t\t\t\t\t\t\t$headline\tnew\t\t$summary\t\\n$summary\\n$text\told imported
|
||||
X
|
||||
undef $type;
|
||||
undef $first;
|
||||
$text = '';
|
||||
}
|
||||
|
||||
<I>; # skip first line
|
||||
while (<I>) {
|
||||
next if /^[_¯]+$/;
|
||||
next if /^\|/;
|
||||
if ( /^== (.+) =====/ ) {
|
||||
&output;
|
||||
$headline = $1;
|
||||
undef $sub;
|
||||
next;
|
||||
}
|
||||
if ( /^(-|\+|\?|\*) (.+)$/ ) {
|
||||
&output;
|
||||
$type = $1;
|
||||
$first = "$1 $2";
|
||||
next;
|
||||
}
|
||||
if ( /^\> (.+)$/ ) {
|
||||
&output;
|
||||
$sub = $1;
|
||||
# print STDERR $_;
|
||||
next;
|
||||
}
|
||||
if ( /^\>\>\>/ ) {
|
||||
&output;
|
||||
undef $sub;
|
||||
next;
|
||||
}
|
||||
if ( /^=+$/ ) {
|
||||
&output;
|
||||
exit;
|
||||
}
|
||||
# if ( /^ (.+)$/ or /^\t(.+)$/ ) {
|
||||
# $text .= $1;
|
||||
# next;
|
||||
# }
|
||||
$text .= $_;
|
||||
# print STDERR;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue