[Bps-public-commit] r11716 - in Prophet/trunk: . lib/Prophet lib/Prophet/Replica lib/Prophet/Resolver t

jesse at bestpractical.com jesse at bestpractical.com
Sun Apr 13 20:44:27 EDT 2008


Author: jesse
Date: Sun Apr 13 20:44:26 2008
New Revision: 11716

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Change.pm
   Prophet/trunk/lib/Prophet/Conflict.pm
   Prophet/trunk/lib/Prophet/ConflictingChange.pm
   Prophet/trunk/lib/Prophet/Replica.pm
   Prophet/trunk/lib/Prophet/Replica/SVN.pm
   Prophet/trunk/lib/Prophet/Resolver/Prompt.pm
   Prophet/trunk/lib/Prophet/Server/REST.pm
   Prophet/trunk/t/real-conflicting-merge.t
   Prophet/trunk/t/simple-conflicting-merge.t
   Prophet/trunk/t/simple-push.t

Log:
 r29646 at 31b:  jesse | 2008-04-13 19:12:54 -0400
  node_exists, node_type => record_$1


Modified: Prophet/trunk/lib/Prophet/Change.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Change.pm	(original)
+++ Prophet/trunk/lib/Prophet/Change.pm	Sun Apr 13 20:44:26 2008
@@ -6,7 +6,7 @@
 
 use Prophet::PropChange;
 use Params::Validate;
-__PACKAGE__->mk_accessors(qw/node_type node_uuid change_type resolution_cas/);
+__PACKAGE__->mk_accessors(qw/record_type node_uuid change_type resolution_cas/);
 
 =head1 NAME
 
@@ -18,7 +18,7 @@
 
 =head1 METHODS
 
-=head2 node_type
+=head2 record_type
 
 The record type for the node.
 
@@ -53,7 +53,7 @@
         {   is_resolution  => 1,
             resolution_cas => $conflict->cas_key,
             change_type    => $conflict->change_type,
-            node_type      => $conflict->node_type,
+            record_type      => $conflict->record_type,
             node_uuid      => $conflict->node_uuid
         }
     );
@@ -88,7 +88,7 @@
     }
 
     return {
-        node_type    => $self->node_type,
+        record_type    => $self->record_type,
         change_type  => $self->change_type,
         prop_changes => $props
 
@@ -100,7 +100,7 @@
     my $uuid    = shift;
     my $hashref = shift;
     my $self    = $class->new(
-        { node_type => $hashref->{'node_type'}, node_uuid => $uuid, change_type => $hashref->{'change_type'} } );
+        { record_type => $hashref->{'record_type'}, node_uuid => $uuid, change_type => $hashref->{'change_type'} } );
     foreach my $prop ( keys %{ $hashref->{'prop_changes'} } ) {
         $self->add_prop_change(
             name => $prop,

Modified: Prophet/trunk/lib/Prophet/Conflict.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Conflict.pm	(original)
+++ Prophet/trunk/lib/Prophet/Conflict.pm	Sun Apr 13 20:44:26 2008
@@ -85,7 +85,7 @@
     my ($change) = validate_pos( @_, { isa => "Prophet::Change" } );
     my $file_op_conflict = '';
 
-    my $file_exists = $self->prophet_handle->node_exists( uuid => $change->node_uuid, type => $change->node_type );
+    my $file_exists = $self->prophet_handle->record_exists( uuid => $change->node_uuid, type => $change->record_type );
 
     # It's ok to delete a node that exists
     if ( $change->change_type eq 'delete' && !$file_exists ) {
@@ -101,9 +101,9 @@
     }
 
     my $change_conflict = Prophet::ConflictingChange->new(
-        {   node_type          => $change->node_type,
+        {   record_type          => $change->record_type,
             node_uuid          => $change->node_uuid,
-            target_node_exists => $file_exists,
+            target_record_exists => $file_exists,
             change_type        => $change->change_type,
             file_op_conflict   => $file_op_conflict
         }
@@ -111,7 +111,7 @@
 
     if ($file_exists) {
         my $current_state
-            = $self->prophet_handle->get_node_props( uuid => $change->node_uuid, type => $change->node_type );
+            = $self->prophet_handle->get_node_props( uuid => $change->node_uuid, type => $change->record_type );
 
         push @{ $change_conflict->prop_conflicts }, $self->_generate_prop_change_conflicts( $change, $current_state );
     }
@@ -186,7 +186,7 @@
 
     for my $conflict ( @{ $self->conflicting_changes } ) {
         my $nullify_conflict
-            = Prophet::Change->new( { node_type => $conflict->node_type, node_uuid => $conflict->node_uuid } );
+            = Prophet::Change->new( { record_type => $conflict->record_type, node_uuid => $conflict->node_uuid } );
 
         if ( $conflict->file_op_conflict eq "delete_missing_file" ) {
             $nullify_conflict->change_type('add_file');

Modified: Prophet/trunk/lib/Prophet/ConflictingChange.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/ConflictingChange.pm	(original)
+++ Prophet/trunk/lib/Prophet/ConflictingChange.pm	Sun Apr 13 20:44:26 2008
@@ -9,7 +9,7 @@
 use Storable 'dclone';
 
 # change_type is one of: add_file add_dir update delete
-__PACKAGE__->mk_accessors(qw/node_type node_uuid source_node_exists target_node_exists change_type file_op_conflict/);
+__PACKAGE__->mk_accessors(qw/record_type node_uuid source_record_exists target_record_exists change_type file_op_conflict/);
 
 =head2 prop_conflicts
 

Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Sun Apr 13 20:44:26 2008
@@ -351,8 +351,8 @@
 
     # XXX: encapsulation
     $changeset->{changes} = [
-        grep { $self->is_resdb || $_->node_type ne '_prophet_resolution' }
-            grep { !( $_->node_type eq $MERGETICKET_METATYPE && $_->node_uuid eq $self->uuid ) }
+        grep { $self->is_resdb || $_->record_type ne '_prophet_resolution' }
+            grep { !( $_->record_type eq $MERGETICKET_METATYPE && $_->node_uuid eq $self->uuid ) }
             $changeset->changes
     ];
 }
@@ -588,7 +588,7 @@
     my $self      = shift;
     my ($change) = validate_pos(@_, { isa => 'Prophet::Change'});
 
-    return 1 if $self->node_exists(
+    return 1 if $self->record_exists(
         uuid => $self->uuid,
         type => '_prophet_resolution-' . $change->resolution_cas
     );
@@ -636,12 +636,12 @@
 
     my %new_props = map { $_->name => $_->new_value } $change->prop_changes;
     if ( $change->change_type eq 'add_file' ) {
-        $self->create_node( type  => $change->node_type, uuid  => $change->node_uuid, props => \%new_props);
+        $self->create_node( type  => $change->record_type, uuid  => $change->node_uuid, props => \%new_props);
     } elsif ( $change->change_type eq 'add_dir' ) {
     } elsif ( $change->change_type eq 'update_file' ) {
-        $self->set_node_props( type  => $change->node_type, uuid  => $change->node_uuid, props => \%new_props);
+        $self->set_node_props( type  => $change->record_type, uuid  => $change->node_uuid, props => \%new_props);
     } elsif ( $change->change_type eq 'delete' ) {
-        $self->delete_node( type => $change->node_type, uuid => $change->node_uuid);
+        $self->delete_node( type => $change->record_type, uuid => $change->node_uuid);
     } else {
         Carp::confess( " I have never heard of the change type: " . $change->change_type );
     }
@@ -774,7 +774,7 @@
         root => $self->repo_handle->fs->revision_root( $self->repo_handle->fs->youngest_rev - 1 )
     );
 
-=head2 node_exists {uuid => $uuid, type => $type, root => $root }
+=head2 record_exists {uuid => $uuid, type => $type, root => $root }
 
 Returns true if the node in question exists. False otherwise
 

Modified: Prophet/trunk/lib/Prophet/Replica/SVN.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica/SVN.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica/SVN.pm	Sun Apr 13 20:44:26 2008
@@ -131,7 +131,7 @@
         if ( $path =~ qr|^(.+)/(.*?)/(.*?)$| ) {
             my ( $prefix, $type, $record ) = ( $1, $2, $3 );
             my $change = Prophet::Change->new(
-                {   node_type   => $type,
+                {   record_type   => $type,
                     node_uuid   => $record,
                     change_type => $entry->{'paths'}->{$path}->{fs_operation}
                 }
@@ -416,13 +416,13 @@
 
 }
 
-=head2 node_exists {uuid => $uuid, type => $type, root => $root }
+=head2 record_exists {uuid => $uuid, type => $type, root => $root }
 
 Returns true if the node in question exists. False otherwise
 
 =cut
 
-sub node_exists {
+sub record_exists {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, type => 1, root => undef } );
 

Modified: Prophet/trunk/lib/Prophet/Resolver/Prompt.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Resolver/Prompt.pm	(original)
+++ Prophet/trunk/lib/Prophet/Resolver/Prompt.pm	Sun Apr 13 20:44:26 2008
@@ -11,7 +11,7 @@
 
     my $resolution = Prophet::Change->new_from_conflict($conflicting_change);
     print "Oh no! There's a conflict between this replica and the one you're syncing from:\n";
-    print $conflicting_change->node_type . " " . $conflicting_change->node_uuid . "\n";
+    print $conflicting_change->record_type . " " . $conflicting_change->node_uuid . "\n";
 
     for my $prop_conflict ( @{ $conflicting_change->prop_conflicts } ) {
 

Modified: Prophet/trunk/lib/Prophet/Server/REST.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server/REST.pm	(original)
+++ Prophet/trunk/lib/Prophet/Server/REST.pm	Sun Apr 13 20:44:26 2008
@@ -105,7 +105,7 @@
 
     my $record = Prophet::Record->new( handle => $self->prophet_handle, type => $args{type} );
     if ( $args{'uuid'} ) {
-        return undef unless ( $self->prophet_handle->node_exists( type => $args{'type'}, uuid => $args{'uuid'} ) );
+        return undef unless ( $self->prophet_handle->record_exists( type => $args{'type'}, uuid => $args{'uuid'} ) );
         $record->load( uuid => $args{uuid} );
     }
     return $record;

Modified: Prophet/trunk/t/real-conflicting-merge.t
==============================================================================
--- Prophet/trunk/t/real-conflicting-merge.t	(original)
+++ Prophet/trunk/t/real-conflicting-merge.t	Sun Apr 13 20:44:26 2008
@@ -152,7 +152,7 @@
         [   {   changes => {
                     $record_id => {
                         change_type  => 'update_file',
-                        node_type    => 'Bug',
+                        record_type    => 'Bug',
                         prop_changes => {
                             status => {
                                 old_value => 'stalled',
@@ -178,7 +178,7 @@
                 original_source_uuid => as_alice { replica_uuid() },
                 changes              => {
                     $record_id => {
-                        node_type    => 'Bug',
+                        record_type    => 'Bug',
                         change_type  => 'update_file',
                         prop_changes => {
                             status => { old_value => 'new', new_value => 'open' }
@@ -189,7 +189,7 @@
                     as_alice {
                         replica_uuid();
                     } => {
-                        node_type    => '_merge_tickets',
+                        record_type    => '_merge_tickets',
                         change_type  => 'update_file',
                         prop_changes => {
                             'last-changeset' => {
@@ -211,7 +211,7 @@
                 original_source_uuid => replica_uuid(),
                 changes              => {
                     $record_id => {
-                        node_type    => 'Bug',
+                        record_type    => 'Bug',
                         change_type  => 'update_file',
                         prop_changes => {
                             status => { old_value => 'open', new_value => 'stalled' }

Modified: Prophet/trunk/t/simple-conflicting-merge.t
==============================================================================
--- Prophet/trunk/t/simple-conflicting-merge.t	(original)
+++ Prophet/trunk/t/simple-conflicting-merge.t	Sun Apr 13 20:44:26 2008
@@ -115,7 +115,7 @@
             changes              => {
                 $record_id => {
                     change_type  => 'update_file',
-                    node_type    => 'Bug',
+                    record_type    => 'Bug',
                     prop_changes => { status => { old_value => 'stalled', new_value => 'new' } }
                     }
 
@@ -151,14 +151,14 @@
             original_source_uuid => replica_uuid_for('alice'),
             changes              => {
                 $record_id => {
-                    node_type    => 'Bug',
+                    record_type    => 'Bug',
                     change_type  => 'update_file',
                     prop_changes => { status => { old_value => 'new', new_value => 'stalled' } }
                 },
 
                 replica_uuid_for('alice') => {
                     change_type  => 'update_file',
-                    node_type    => '_merge_tickets',
+                    record_type    => '_merge_tickets',
                     prop_changes => {
                         'last-changeset' => {
                             old_value => as_alice { replica_last_rev() - 1 },

Modified: Prophet/trunk/t/simple-push.t
==============================================================================
--- Prophet/trunk/t/simple-push.t	(original)
+++ Prophet/trunk/t/simple-push.t	Sun Apr 13 20:44:26 2008
@@ -78,7 +78,7 @@
                             'old_value' => undef
                         }
                     },
-                    'node_type' => 'Bug'
+                    'record_type' => 'Bug'
                 }
             },
             'is_nullification' => undef,
@@ -130,7 +130,7 @@
                             'old_value' => undef
                         }
                     },
-                    'node_type' => 'Bug'
+                    'record_type' => 'Bug'
                 }
             },
             'is_nullification' => undef,



More information about the Bps-public-commit mailing list