[Bps-public-commit] r12460 - in Prophet/branches/moose: . t

sartak at bestpractical.com sartak at bestpractical.com
Sat May 17 05:53:37 EDT 2008


Author: sartak
Date: Sat May 17 05:53:19 2008
New Revision: 12460

Modified:
   Prophet/branches/moose/   (props changed)
   Prophet/branches/moose/lib/Prophet/ChangeSet.pm
   Prophet/branches/moose/lib/Prophet/Replica.pm
   Prophet/branches/moose/t/export.t
   Prophet/branches/moose/t/simple-push.t

Log:
 r56188 at onn:  sartak | 2008-05-17 05:52:37 -0400
 Change ChangeSet->is_empty to ChangeSet->has_changes so we can use MX::AH's provided method


Modified: Prophet/branches/moose/lib/Prophet/ChangeSet.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/ChangeSet.pm	(original)
+++ Prophet/branches/moose/lib/Prophet/ChangeSet.pm	Sat May 17 05:53:19 2008
@@ -42,6 +42,7 @@
     default    => sub { [] },
     provides   => {
         push   => '_add_change',
+        empty  => 'has_changes',
     },
 );
 
@@ -110,17 +111,12 @@
 
 =cut
 
-=head2 is_empty
+=head2 has_changes
 
-Returns true if this changeset has no changes
+Returns true if this changeset has any changes
 
 =cut
 
-sub is_empty {
-    my $self = shift;
-    return @{ $self->changes } ? 0 : 1;
-}
-
 our @SERIALIZE_PROPS
     = (qw(sequence_no source_uuid original_source_uuid original_sequence_no is_nullification is_resolution));
 

Modified: Prophet/branches/moose/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/Replica.pm	(original)
+++ Prophet/branches/moose/lib/Prophet/Replica.pm	Sat May 17 05:53:19 2008
@@ -175,7 +175,7 @@
     return if ($changeset->is_nullification);
 
     $self->remove_redundant_data($changeset);    #Things we have already seen
-    return if ($changeset->is_empty);
+    return unless $changeset->has_changes;
 
 
 
@@ -539,7 +539,7 @@
         # Otherwise, record them locally
     my $res_handle =  $self->resolution_db_handle || $self;
 
-    return if $changeset->is_empty;
+    return unless $changeset->has_changes;
 
     $self->begin_edit();
     $self->record_changes($changeset);

Modified: Prophet/branches/moose/t/export.t
==============================================================================
--- Prophet/branches/moose/t/export.t	(original)
+++ Prophet/branches/moose/t/export.t	Sat May 17 05:53:19 2008
@@ -58,7 +58,7 @@
     use_ok('Prophet::Replica::Native');
     diag("Checking changesets in $path");
     my $changesets =  Prophet::Replica->new( { url => 'prophet:file://' . $path } )->fetch_changesets( after => 0 );
-    my @changesets = grep {!$_->is_empty} @$changesets;
+    my @changesets = grep {$_->has_changes} @$changesets;
     is( $#changesets, 2, "We found a total of 3 changesets" );
     # XXX: compare the changeset structure
     is( lc( $changesets->[-1]->{source_uuid} ), lc( $changesets->[-1]->{original_source_uuid} ) );

Modified: Prophet/branches/moose/t/simple-push.t
==============================================================================
--- Prophet/branches/moose/t/simple-push.t	(original)
+++ Prophet/branches/moose/t/simple-push.t	Sat May 17 05:53:19 2008
@@ -45,7 +45,7 @@
 };
 
 is_deeply(
-    [ map { $_->as_hash } grep { !$_->is_empty}  @$changesets ],
+    [ map { $_->as_hash } grep { $_->has_changes }  @$changesets ],
     [ 
         {   'sequence_no'          => 3,
             'original_sequence_no' => 3,
@@ -96,7 +96,7 @@
 
 $changesets = $bob->new_changesets_for($alice);
 
-my @changes = map { $_->as_hash } grep {!$_->is_empty} @$changesets;
+my @changes = map { $_->as_hash } grep { $_->has_changes } @$changesets;
 
 is_deeply(
     \@changes,



More information about the Bps-public-commit mailing list