[Bps-public-commit] r11478 - in SVN-PropDB: . doc lib/Prophet
jesse at bestpractical.com
jesse at bestpractical.com
Fri Apr 4 00:07:14 EDT 2008
Author: jesse
Date: Fri Apr 4 00:07:05 2008
New Revision: 11478
Modified:
SVN-PropDB/ (props changed)
SVN-PropDB/doc/todo
SVN-PropDB/lib/Prophet/Record.pm
SVN-PropDB/lib/Prophet/Sync/Source/RT.pm
Log:
r29143 at 70-5-183-240: jesse | 2008-04-03 18:05:26 -1000
* todo, RT.pm perltidy
Modified: SVN-PropDB/doc/todo
==============================================================================
--- SVN-PropDB/doc/todo (original)
+++ SVN-PropDB/doc/todo Fri Apr 4 00:07:05 2008
@@ -57,14 +57,42 @@
Bug tracker:
- subject
- status
- severity
- custom fields
- owner
- keywords/tags
- reported by
-
+ summary RT: subject
+ status RT: status(new,open,stalled,resolved, rejected)
+ severity
+ custom fields RT: cf-*
+ owner RT: owner
+ keywords/tags
+[csv]reported by RT: requestors
+ comments RT: comment/correspond
+ RT: Queue
+ RT: priority
+ RT: initial_priority
+ RT: final_priority
+ RT: time_estimated
+ RT: time_worked
+ RT: time_left
+[dt] RT: created
+[dt] RT: starts
+ RT: started
+ RT: lastupdated
+ RT: resolved
+ RT: told (last user contact)
+[csv] RT: links * many
+[csv] DependsOn
+[csv] DependedOnBy
+[csv] RefersTo
+[csv] ReferredToBy
+[csv] MemberOf
+[csv] HasMember
+
+[csv] RT: admin_ccs
+[csv] RT: ccs
+
+
+
+
+
attachments / patches
milestones?
Modified: SVN-PropDB/lib/Prophet/Record.pm
==============================================================================
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 Fri Apr 4 00:07:05 2008
@@ -5,7 +5,7 @@
use base qw/Prophet::Sync::Source/;
use Params::Validate qw(:all);
use UNIVERSAL::require;
-use RT::Client::REST ();
+use RT::Client::REST ();
use RT::Client::REST::User ();
use Memoize;
use Prophet::Handle;
@@ -28,18 +28,19 @@
sub setup {
my $self = shift;
- my ($server, $type, $query) = $self->{url} =~ m/^rt:(.*?):(tickets):(.*)$/
+ my ( $server, $type, $query ) = $self->{url} =~ m/^rt:(.*?):(tickets):(.*)$/
or die "Can't parse rt server spec";
my $uri = URI->new($server);
- my ($username, $password);
- if (my $auth = $uri->userinfo) {
- ($username, $password) = split /:/, $auth, 2;
+ my ( $username, $password );
+ if ( my $auth = $uri->userinfo ) {
+ ( $username, $password ) = split /:/, $auth, 2;
$uri->userinfo(undef);
}
- $self->rt_url( "$uri" );
- $self->rt_query( $query );
- $self->rt( RT::Client::REST->new(server => $server) );
+ $self->rt_url("$uri");
+ $self->rt_query($query);
+ $self->rt( RT::Client::REST->new( server => $server ) );
unless ($username) {
+
# XXX belongs to some CLI callback
use Term::ReadKey;
local $| = 1;
@@ -54,14 +55,14 @@
ReadMode 1;
print "\n";
}
- $self->rt->login(username => $username, password => $password);
+ $self->rt->login( username => $username, password => $password );
my $orz = tempdir();
$self->{___Orz} = $orz;
- SVN::Repos::create($orz, undef, undef, undef, undef);
+ SVN::Repos::create( $orz, undef, undef, undef, undef );
$self->ressource( __PACKAGE__->new( { url => "file://$orz", is_resdb => 1 } ) );
}
-sub fetch_resolutions { warn 'no resdb'}
+sub fetch_resolutions { warn 'no resdb' }
=head2 uuid
@@ -71,15 +72,15 @@
sub uuid {
my $self = shift;
- return $self->uuid_for_url( join('/', $self->rt_url, $self->rt_query ) );
+ return $self->uuid_for_url( join( '/', $self->rt_url, $self->rt_query ) );
}
use Data::UUID 'NameSpace_DNS';
sub uuid_for_url {
- my ($self, $url) = @_;
- return Data::UUID->new->create_from_name_str( NameSpace_DNS, $url);
+ my ( $self, $url ) = @_;
+ return Data::UUID->new->create_from_name_str( NameSpace_DNS, $url );
}
=head2 fetch_changesets { after => SEQUENCE_NO }
@@ -97,13 +98,19 @@
my $first_rev = ( $args{'after'} + 1 ) || 1;
- my @changesets;
+ my @changesets;
my %tix;
- for my $id ($self->_find_matching_tickets) {
- push @changesets, @{ $self->_recode_transactions( ticket => $self->rt->show(type => 'ticket', id => $id), transactions => $self->_find_matching_transactions($id)) };
+ for my $id ( $self->_find_matching_tickets ) {
+ push @changesets,
+ @{
+ $self->_recode_transactions(
+ ticket => $self->rt->show( type => 'ticket', id => $id ),
+ transactions => $self->_find_matching_transactions($id)
+ )
+ };
}
die 'not yet';
- my @results = sort { $a->original_sequence_no <=> $b->original_sequence_no } @changesets;
+ my @results = map { $self->translate_prop_names($_) } sort { $a->original_sequence_no <=> $b->original_sequence_no } @changesets;
return \@results;
}
@@ -113,34 +120,35 @@
my $ticket = $args{'ticket'};
- warn "Working on ".$ticket->{id};
+ 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->{$_} = $self->date_to_iso( $create_state->{$_} ) }
+ qw(Created Resolved Told LastUpdated Starts Started);
- map { $create_state->{$_} =~ s/ minutes$// } qw(TimeWorked TimeLeft TimeEstimated);
+ map { $create_state->{$_} =~ s/ minutes$// } qw(TimeWorked TimeLeft TimeEstimated);
my @changesets;
for my $txn ( sort { $b->{'id'} <=> $a->{'id'} } @{ $args{'transactions'} } ) {
if ( my $sub = $self->can( '_recode_txn_' . $txn->{'Type'} ) ) {
my $changeset = Prophet::ChangeSet->new(
- {
- original_source_uuid => $self->uuid,
+ { original_source_uuid => $self->uuid,
original_sequence_no => $txn->{'id'},
}
);
- if (("ticket/".$txn->{'Ticket'} ne $ticket->{id} )&& $txn->{'Type'} !~ /^(?:Comment|Correspond)$/) {
- warn "Skipping a data change from a merged ticket" . $txn->{'Ticket'} . ' vs '. $ticket->{id};
+ if ( ( "ticket/" . $txn->{'Ticket'} ne $ticket->{id} ) && $txn->{'Type'} !~ /^(?:Comment|Correspond)$/ ) {
+ warn "Skipping a data change from a merged ticket" . $txn->{'Ticket'} . ' vs ' . $ticket->{id};
next;
- }
+ }
- $sub->( $self,
+ $sub->(
+ $self,
ticket => $ticket,
create_state => $create_state,
txn => $txn,
- changeset => $changeset );
+ changeset => $changeset
+ );
unshift @changesets, $changeset unless $changeset->is_empty;
- }
- else {
+ } else {
warn "not handling txn type $txn->{Type} for $txn->{id} (Ticket $args{ticket}{id}) yet";
die YAML::Dump($txn);
}
@@ -151,232 +159,238 @@
}
-
-sub _recode_txn_EmailRecord { return ;}
-sub _recode_txn_AddReminder { return ;}
-sub _recode_txn_ResolveReminder { return ;}
-sub _recode_txn_DeleteLink {}
+sub _recode_txn_EmailRecord { return; }
+sub _recode_txn_AddReminder { return; }
+sub _recode_txn_ResolveReminder { return; }
+sub _recode_txn_DeleteLink { }
sub _recode_txn_Status {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1});
-
- $args{txn}->{'Type'} = 'Set';
-
- return $self->_recode_txn_Set(%args);
- }
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
+ $args{txn}->{'Type'} = 'Set';
+ return $self->_recode_txn_Set(%args);
+}
-sub _recode_txn_Told {
+sub _recode_txn_Told {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1});
- $args{txn}->{'Type'} = 'Set';
- return $self->_recode_txn_Set(%args);
-}
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
+ $args{txn}->{'Type'} = 'Set';
+ return $self->_recode_txn_Set(%args);
+}
sub _recode_txn_Set {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset=>1});
-
- my $change = Prophet::Change->new(
- { node_type => 'ticket',
- node_uuid => $self->uuid_for_url ( $self->rt_url . "/ticket/" . $args{'create_state'}->{'id'}),
- change_type => 'update_file'
- }
- );
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
- if ( $args{txn}->{Field} eq 'Queue') {
- my $current_queue = $args{ticket}->{'Queue'};
- my $user = $args{txn}->{Creator};
- if ($args{txn}->{Description} =~ /Queue changed from (.*) to $current_queue by $user/) {
- $args{txn}->{OldValue} = $1;
- $args{txn}->{NewValue} = $current_queue;
- }
+ my $change = Prophet::Change->new(
+ { node_type => 'ticket',
+ node_uuid => $self->uuid_for_url( $self->rt_url . "/ticket/" . $args{'create_state'}->{'id'} ),
+ change_type => 'update_file'
+ }
+ );
- } elsif ( $args{txn}->{Field} eq 'Owner') {
- $args{'txn'}->{NewValue} = $self->resolve_user_id_to(name => $args{'txn'}->{'NewValue'} ),
- $args{'txn'}->{OldValue} = $self->resolve_user_id_to(name => $args{'txn'}->{'OldValue'} )
-
+ if ( $args{txn}->{Field} eq 'Queue' ) {
+ my $current_queue = $args{ticket}->{'Queue'};
+ my $user = $args{txn}->{Creator};
+ if ( $args{txn}->{Description} =~ /Queue changed from (.*) to $current_queue by $user/ ) {
+ $args{txn}->{OldValue} = $1;
+ $args{txn}->{NewValue} = $current_queue;
}
+ } elsif ( $args{txn}->{Field} eq 'Owner' ) {
+ $args{'txn'}->{NewValue} = $self->resolve_user_id_to( name => $args{'txn'}->{'NewValue'} ),
+ $args{'txn'}->{OldValue}
+ = $self->resolve_user_id_to( name => $args{'txn'}->{'OldValue'} )
- $args{'changeset'}->add_change( { change => $change } );
- if ( $args{'create_state'}->{ $args{txn}->{Field} } eq $args{txn}->{'NewValue'} ) {
- $args{'create_state'}->{ $args{txn}->{Field} } = $args{txn}->{'OldValue'};
- } else {
- $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'},
- old => $args{txn}->{'OldValue'},
- new => $args{txn}->{'NewValue'}
+ }
- );
+ $args{'changeset'}->add_change( { change => $change } );
+ if ( $args{'create_state'}->{ $args{txn}->{Field} } eq $args{txn}->{'NewValue'} ) {
+ $args{'create_state'}->{ $args{txn}->{Field} } = $args{txn}->{'OldValue'};
+ } else {
+ $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'},
+ old => $args{txn}->{'OldValue'},
+ new => $args{txn}->{'NewValue'}
- }
+ );
+
+}
*_recode_txn_Steal = \&_recode_txn_Set;
-*_recode_txn_Take = \&_recode_txn_Set;
-*_recode_txn_Give = \&_recode_txn_Set;
+*_recode_txn_Take = \&_recode_txn_Set;
+*_recode_txn_Give = \&_recode_txn_Set;
-
sub _recode_txn_Create {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset=>1});
-
- my $change = Prophet::Change->new(
- { node_type => 'ticket',
- node_uuid => $self->uuid_for_url ( $self->rt_url . "/ticket/" . $args{'create_state'}->{'id'}),
- change_type => 'add_file'
- }
- );
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
- $args{'create_state'}->{'id'} =~ s/^ticket\///g;
- $args{'changeset'}->add_change( { change => $change } );
- for my $name ( keys %{$args{'create_state'}} ) {
+ my $change = Prophet::Change->new(
+ { node_type => 'ticket',
+ node_uuid => $self->uuid_for_url( $self->rt_url . "/ticket/" . $args{'create_state'}->{'id'} ),
+ change_type => 'add_file'
+ }
+ );
- $change->add_prop_change(
- name => $name,
- old => undef,
- new => $args{'create_state'}->{$name},
- );
+ $args{'create_state'}->{'id'} =~ s/^ticket\///g;
+ $args{'changeset'}->add_change( { change => $change } );
+ for my $name ( keys %{ $args{'create_state'} } ) {
+
+ $change->add_prop_change(
+ name => $name,
+ old => undef,
+ new => $args{'create_state'}->{$name},
+ );
- }
-
- $self->_recode_content_update(%args); # add the create content txn as a seperate change in this changeset
+ }
- }
+ $self->_recode_content_update(%args); # add the create content txn as a seperate change in this changeset
+
+}
sub _recode_txn_AddLink {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset=>1});
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
warn "Recode links to actually be attributes rather than another table";
- my $change = Prophet::Change->new(
- { node_type => 'rt_link',
- node_uuid => $self->uuid_for_url ( $self->rt_url . "/link/" . $args{'txn'}->{'id'}),
- 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} );
+ my $change = Prophet::Change->new(
+ { node_type => 'rt_link',
+ node_uuid => $self->uuid_for_url( $self->rt_url . "/link/" . $args{'txn'}->{'id'} ),
+ 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} );
+}
sub _recode_content_update {
- my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset=>1});
- my $change = Prophet::Change->new(
- { node_type => 'rt_'.$args{'txn'}->{'Type'},
- node_uuid => $self->uuid_for_url($self->rt_url . "/transaction/" . $args{'txn'}->{'id'}),
- change_type => 'add_file'
- }
- );
- $change->add_prop_change(
- name => 'creator',
- old => undef,
- new => $args{'txn'}->{'Creator'}
- );
- $change->add_prop_change(
- name => 'content',
- old => undef,
- new => $args{'txn'}->{'Content'}
- );
- $change->add_prop_change(
- name => 'ticket',
- old => undef,
- new => $args{ticket}->{uuid},
- );
- $args{'changeset'}->add_change( { change => $change } );
+ my $self = shift;
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
+ my $change = Prophet::Change->new(
+ { node_type => 'comment',
+ node_uuid => $self->uuid_for_url( $self->rt_url . "/transaction/" . $args{'txn'}->{'id'} ),
+ change_type => 'add_file'
}
+ );
+ $change->add_prop_change(
+ name => 'type',
+ old => undef,
+ new => $args{'txn'}->{'Type'}
+ );
+ $change->add_prop_change(
+ name => 'creator',
+ old => undef,
+ new => $args{'txn'}->{'Creator'}
+ );
+ $change->add_prop_change(
+ name => 'content',
+ old => undef,
+ new => $args{'txn'}->{'Content'}
+ );
+ $change->add_prop_change(
+ name => 'ticket',
+ old => undef,
+ new => $args{ticket}->{uuid},
+ );
+ $args{'changeset'}->add_change( { change => $change } );
+}
-*_recode_txn_Comment = \&_recode_content_update;
+*_recode_txn_Comment = \&_recode_content_update;
*_recode_txn_Correspond = \&_recode_content_update;
sub _recode_txn_AddWatcher {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset=>1});
-
-
- my $new_state = $args{'create_state'}->{ $args{'txn'}->{'Field'} };
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
- $args{'create_state'}->{ $args{'txn'}->{'Field'} } = $self->warp_list_to_old_value(
- $args{'create_state'}->{ $args{'txn'}->{'Field'} },
+ my $new_state = $args{'create_state'}->{ $args{'txn'}->{'Field'} };
- $self->resolve_user_id_to( email => $args{'txn'}->{'NewValue'} ),
- $self->resolve_user_id_to( email => $args{'txn'}->{'OldValue'} )
+ $args{'create_state'}->{ $args{'txn'}->{'Field'} } = $self->warp_list_to_old_value(
+ $args{'create_state'}->{ $args{'txn'}->{'Field'} },
- );
+ $self->resolve_user_id_to( email => $args{'txn'}->{'NewValue'} ),
+ $self->resolve_user_id_to( email => $args{'txn'}->{'OldValue'} )
- my $change = Prophet::Change->new(
- { node_type => 'ticket',
- node_uuid => $self->uuid_for_url($self->rt_url . "/ticket/" . $args{'create_state'}->{'id'}),
- change_type => 'update_file'
- }
- );
- $args{'changeset'}->add_change( { change => $change } );
- $change->add_prop_change(
- name => $args{'txn'}->{'Field'},
- old => $args{'create_state'}->{ $args{'txn'}->{'Field'} },
- new => $new_state
- );
+ );
+ my $change = Prophet::Change->new(
+ { node_type => 'ticket',
+ node_uuid => $self->uuid_for_url( $self->rt_url . "/ticket/" . $args{'create_state'}->{'id'} ),
+ change_type => 'update_file'
}
-
-*_recode_txn_DelWatcher = \&_recode_txn_AddWatcher;
+ );
+ $args{'changeset'}->add_change( { change => $change } );
+ $change->add_prop_change(
+ name => $args{'txn'}->{'Field'},
+ old => $args{'create_state'}->{ $args{'txn'}->{'Field'} },
+ new => $new_state
+ );
+
+}
+
+*_recode_txn_DelWatcher = \&_recode_txn_AddWatcher;
+
sub _recode_txn_CustomField {
my $self = shift;
- my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset=>1});
-
- my $new = $args{'txn'}->{'NewValue'};
- my $old = $args{'txn'}->{'OldValue'};
- my $name;
- if ( $args{'txn'}->{'Description'} =~ /^(.*) $new added by/ ) {
- $name = $1;
-
- } elsif ( $args{'txn'}->{'Description'} =~ /^(.*) $old delete by/ ) {
- $name = $1;
- } else {
- die "Uh. what to do with txn descriotion " . $args{'txn'}->{'Description'};
- }
+ my %args = validate( @_, { ticket => 1, txn => 1, create_state => 1, changeset => 1 } );
- $args{'txn'}->{'Field'} = "CF-" . $name;
+ my $new = $args{'txn'}->{'NewValue'};
+ my $old = $args{'txn'}->{'OldValue'};
+ my $name;
+ if ( $args{'txn'}->{'Description'} =~ /^(.*) $new added by/ ) {
+ $name = $1;
+
+ } elsif ( $args{'txn'}->{'Description'} =~ /^(.*) $old delete by/ ) {
+ $name = $1;
+ } else {
+ die "Uh. what to do with txn descriotion " . $args{'txn'}->{'Description'};
+ }
- my $new_state = $args{'create_state'}->{ $args{'txn'}->{'Field'} };
- $args{'create_state'}->{ $args{'txn'}->{'Field'} } = $self->warp_list_to_old_value( $args{'create_state'}->{ $args{'txn'}->{'Field'} },
- $args{'txn'}->{'NewValue'}, $args{'txn'}->{'OldValue'} );
+ $args{'txn'}->{'Field'} = "CF-" . $name;
- my $change = Prophet::Change->new(
- { node_type => 'ticket',
- node_uuid => $self->uuid_for_url($self->url . "/Ticket/" . $args{'create_state'}->{'id'}),
- change_type => 'update_file'
- }
- );
+ my $new_state = $args{'create_state'}->{ $args{'txn'}->{'Field'} };
+ $args{'create_state'}->{ $args{'txn'}->{'Field'} } = $self->warp_list_to_old_value(
+ $args{'create_state'}->{ $args{'txn'}->{'Field'} },
+ $args{'txn'}->{'NewValue'},
+ $args{'txn'}->{'OldValue'}
+ );
- $args{'changeset'}->add_change( { change => $change } );
- $change->add_prop_change(
- name => $args{'txn'}->{'Field'},
- old => $args{'create_state'}->{ $args{'txn'}->{'Field'} },
- new => $new_state
- );
+ my $change = Prophet::Change->new(
+ { node_type => 'ticket',
+ node_uuid => $self->uuid_for_url( $self->url . "/Ticket/" . $args{'create_state'}->{'id'} ),
+ change_type => 'update_file'
}
+ );
+
+ $args{'changeset'}->add_change( { change => $change } );
+ $change->add_prop_change(
+ name => $args{'txn'}->{'Field'},
+ old => $args{'create_state'}->{ $args{'txn'}->{'Field'} },
+ new => $new_state
+ );
+}
+
sub resolve_user_id_to {
- my $self = shift;
+ my $self = shift;
my $attr = shift;
- my $id = shift;
+ my $id = shift;
return undef unless ($id);
-
- my $user = RT::Client::REST::User->new(rt => $self->rt, id => $id)->retrieve;
- return $attr eq 'name' ? $user->name : $user->email_address;
+
+ my $user = RT::Client::REST::User->new( rt => $self->rt, id => $id )->retrieve;
+ return $attr eq 'name' ? $user->name : $user->email_address;
}
memoize 'resolve_user_id_to';
-
sub _find_matching_tickets {
my $self = shift;
@@ -390,16 +404,15 @@
}
sub _find_matching_transactions {
- my $self = shift;
+ my $self = shift;
my $ticket = shift;
my @txns;
- for my $txn ($self->rt->get_transaction_ids (parent_id => $ticket ) ) {
- push @txns, $self->rt->get_transaction (parent_id => $ticket, id => $txn, type => 'ticket');
+ for my $txn ( $self->rt->get_transaction_ids( parent_id => $ticket ) ) {
+ push @txns, $self->rt->get_transaction( parent_id => $ticket, id => $txn, type => 'ticket' );
}
return \@txns;
}
-
sub _recode_changeset {
my $self = shift;
my $entry = shift;
@@ -443,7 +456,6 @@
return $changeset;
}
-
=head2 last_changeset_from_source $SOURCE_UUID
Returns the last changeset id seen from the source identified by $SOURCE_UUID
@@ -456,32 +468,61 @@
my ( $stream, $pool );
my $filename = join( "/", $self->prophet_handle->db_root, $Prophet::Handle::MERGETICKET_METATYPE, $source );
- my ( $rev_fetched, $props ) = eval { $self->ra->get_file( $filename, $self->ra->get_latest_revnum, $stream, $pool ); };
+ my ( $rev_fetched, $props )
+ = eval { $self->ra->get_file( $filename, $self->ra->get_latest_revnum, $stream, $pool ); };
return ( $props->{'last-changeset'} || 0 );
}
sub warp_list_to_old_value {
- my $self = shift;
+ my $self = shift;
my $ticket_value = shift;
- my $add = shift;
- my $del = shift;
-
- my @new = split( /\s*,\s*/, $ticket_value );
- my @old = grep { $_ ne $add } @new, $del;
- return join( ", ", @old );
-}
+ my $add = shift;
+ my $del = shift;
-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};
+ my @new = split( /\s*,\s*/, $ticket_value );
+ my @old = grep { $_ ne $add } @new, $del;
+ 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 $self = shift;
my $date = shift;
-
+
return '' if $date eq 'Not set';
- my $t =DateTime::Format::HTTP->parse_datetime($date);
- return $t->ymd . " ".$t->hms;
+ my $t = DateTime::Format::HTTP->parse_datetime($date);
+ return $t->ymd . " " . $t->hms;
}
+sub translate_prop_names {
+ my $self = shift;
+ my $changeset = shift;
+
+ for my $change (@{$changeset->changes}) {
+ next unless $change->node_type eq 'ticket';
+
+# for my $prop
+
+ }
+
+}
+
+
1;
More information about the Bps-public-commit
mailing list