[Bps-public-commit] r11465 - in SVN-PropDB: .
jesse at bestpractical.com
jesse at bestpractical.com
Thu Apr 3 22:36:23 EDT 2008
Author: jesse
Date: Thu Apr 3 22:36:23 2008
New Revision: 11465
Modified:
SVN-PropDB/ (props changed)
SVN-PropDB/lib/Prophet/Sync/Source/RT.pm
Log:
r29125 at 70-5-183-240: jesse | 2008-04-03 16:35:48 -1000
* closer to realistic sync from rt
Modified: SVN-PropDB/lib/Prophet/Sync/Source/RT.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Sync/Source/RT.pm (original)
+++ SVN-PropDB/lib/Prophet/Sync/Source/RT.pm Thu Apr 3 22:36:23 2008
@@ -115,6 +115,8 @@
warn "Working on ".$ticket->{id};
my $create_state = $ticket;
+ map { $create_state->{$_} = $self->date_to_iso($create_state->{$_})} qw(Created Resolved Told LastUpdated Starts Started);
+
map { $create_state->{$_} =~ s/ minutes$// } qw(TimeWorked TimeLeft TimeEstimated);
my @changesets;
for my $txn ( sort { $b->{'id'} <=> $a->{'id'} } @{ $args{'transactions'} } ) {
@@ -203,7 +205,8 @@
if ( $args{'create_state'}->{ $args{txn}->{Field} } eq $args{txn}->{'NewValue'} ) {
$args{'create_state'}->{ $args{txn}->{Field} } = $args{txn}->{'OldValue'};
} else {
- die $args{'create_state'}->{ $args{txn}->{Field} } . " != " . $args{txn}->{'NewValue'}."\n\n".YAML::Dump(\%args);
+ $args{'create_state'}->{ $args{txn}->{Field} } = $args{txn}->{'OldValue'};
+ warn $args{'create_state'}->{ $args{txn}->{Field} } . " != " . $args{txn}->{'NewValue'}."\n\n".YAML::Dump(\%args);
}
$change->add_prop_change(
name => $args{txn}->{'Field'},
@@ -229,6 +232,8 @@
change_type => 'add_file'
}
);
+
+ $args{'create_state'}->{'id'} =~ s/^ticket\///g;
$args{'changeset'}->add_change( { change => $change } );
for my $name ( keys %{$args{'create_state'}} ) {
@@ -239,6 +244,9 @@
);
}
+
+ $self->_recode_content_update(%args); # add the create content txn as a seperate change in this changeset
+
}
sub _recode_txn_AddLink {
@@ -251,6 +259,7 @@
change_type => 'add_file'
}
);
+ $args{'changeset'}->add_change( { change => $change } );
$change->add_prop_change( name => 'url', old => undef, new => $args{'txn'}->{'NewValue'} );
$change->add_prop_change( name => 'type', old => undef, new => $args{'txn'}->{'Field'} );
$change->add_prop_change( name => 'ticket', old => undef, new => $args{ticket}->{uuid} );
@@ -266,6 +275,11 @@
}
);
$change->add_prop_change(
+ name => 'creator',
+ old => undef,
+ new => $args{'txn'}->{'Creator'}
+ );
+ $change->add_prop_change(
name => 'content',
old => undef,
new => $args{'txn'}->{'Content'}
@@ -275,6 +289,7 @@
old => undef,
new => $args{ticket}->{uuid},
);
+ $args{'changeset'}->add_change( { change => $change } );
}
@@ -457,4 +472,16 @@
return join( ", ", @old );
}
+our $MONNUM = { Jan => 1, Feb => 2, Mar => 3, Apr => 4, May => 5, Jun => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12};
+
+use DateTime::Format::HTTP;
+sub date_to_iso {
+ my $self =shift;
+ my $date = shift;
+
+ return '' if $date eq 'Not set';
+ my $t =DateTime::Format::HTTP->parse_datetime($date);
+ return $t->ymd . " ".$t->hms;
+}
+
1;
More information about the Bps-public-commit
mailing list