[Bps-public-commit] r16831 - in sd/trunk: lib/App/SD/Replica/rt

ruz at bestpractical.com ruz at bestpractical.com
Fri Nov 14 06:44:41 EST 2008


Author: ruz
Date: Fri Nov 14 06:44:38 2008
New Revision: 16831

Modified:
   sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm
   sd/trunk/t/sd-hm-group.t

Log:
* minor refactoring before moving forward with fixing failing test

Modified: sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm	Fri Nov 14 06:44:38 2008
@@ -67,7 +67,6 @@
         $self->sync_source->log("Applying changeset ".++$cs_counter . " of ".scalar @changesets); 
         $args{callback}->($_)
     }
-
 }
 
 sub _translate_final_ticket_state {
@@ -268,8 +267,8 @@
     my %args = validate( @_, {  txn => 1, ticket => 1, changeset => 1 } );
 
     my $change = Prophet::Change->new(
-        {   record_type   => 'ticket',
-            record_uuid   => $self->sync_source->uuid_for_remote_id( $args{'ticket'}->{$self->sync_source->uuid . '-id'} ),
+        {   record_type => 'ticket',
+            record_uuid => $self->sync_source->uuid_for_remote_id( $args{'ticket'}->{$self->sync_source->uuid . '-id'} ),
             change_type => 'add_file'
         }
     );
@@ -282,11 +281,9 @@
             old  => undef,
             new  => $args{'ticket'}->{$name},
         );
-
     }
 
     $self->_recode_content_update(%args);    # add the create content txn as a seperate change in this changeset
-
 }
 
 sub _recode_txn_AddLink {
@@ -311,19 +308,17 @@
         old  => $args{'ticket'}->{ $args{'txn'}->{'Field'} },
         new  => $new_state
     );
-
 }
 
 sub _recode_content_update {
-    my $self   = shift;
-    my %args   = validate( @_, { txn => 1, ticket => 1, changeset => 1 } );
+    my $self = shift;
+    my %args = validate( @_, { txn => 1, ticket => 1, changeset => 1 } );
     my $url = $self->sync_source->remote_url . "/transaction/" . $args{'txn'}->{'id'};
-    my $change = Prophet::Change->new(
-        {   record_type => 'comment',
-            record_uuid => $self->sync_source->uuid_for_url( $url ),
-            change_type => 'add_file',
-        }
-    );
+    my $change = Prophet::Change->new( {
+        record_type => 'comment',
+        record_uuid => $self->sync_source->uuid_for_url( $url ),
+        change_type => 'add_file',
+    } );
 
     $change->add_prop_change( name => 'created', old  => undef, new  => $self->date_to_iso($args{'txn'}->{'Created'}));
 

Modified: sd/trunk/t/sd-hm-group.t
==============================================================================
--- sd/trunk/t/sd-hm-group.t	(original)
+++ sd/trunk/t/sd-hm-group.t	Fri Nov 14 06:44:38 2008
@@ -87,36 +87,31 @@
 
 
 my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
-diag $yatta_uuid;
 
 run_output_matches_unordered(
-    'sd',
-    [ 'ticket', 'list', '--regex', '.' ],
+    'sd', [ qw(ticket list --regex .) ],
     [ "$yatta_id YATTA new", "$flyman_id Crash Man (no status)" ]
 );
 
 {
-    ( $ret, $out, $err ) = run_script( 'sd', [ 'push','--to', $sd_hm_url ] );
-    diag $err;
-    ok( $task->load_by_cols( summary => 'YATTA' ), "loaded HM task" );
+    my ( $ret, $out, $err ) = run_script( 'sd', [ 'push','--to', $sd_hm_url ] );
+    ok( $task->load_by_cols( summary => 'YATTA' ), "loaded HM task #". $task->id );
     is( $task->group->id, $gid, "is in correct group" );
 }
 
 {
-    ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
+    my ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
     run_output_matches_unordered(
-        'sd',
-        [ 'ticket',                     'list', '--regex', '.' ],
+        'sd', [ qw(ticket list --regex .) ],
         [ "$yatta_id YATTA new", "$flyman_id Crash Man (no status)" ]
     );
 }
 
 {
-    $task->set_summary('KILL');
-    ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
+    my @res = $task->set_summary('KILL');
+    my ($ret, $out, $err) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
     run_output_matches_unordered(
-        'sd',
-        [ 'ticket',                    'list', '--regex', '.' ],
+        'sd', [ qw(ticket list --regex .) ],
         [ "$yatta_id KILL new", "$flyman_id Crash Man (no status)" ]
     );
 }



More information about the Bps-public-commit mailing list