[Bps-public-commit] r11266 - in SVN-PropDB: . lib/Prophet/Sync/Source/SVN

jesse at bestpractical.com jesse at bestpractical.com
Sat Mar 29 22:12:13 EDT 2008


Author: jesse
Date: Sat Mar 29 22:12:13 2008
New Revision: 11266

Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/lib/Prophet/Handle.pm
   SVN-PropDB/lib/Prophet/Sync/Source/SVN/ReplayEditor.pm

Log:
 r28788 at 70-5-172-195:  jesse | 2008-03-29 16:10:29 -1000
 * Prophet now passes full pod test coverage


Modified: SVN-PropDB/lib/Prophet/Handle.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Handle.pm	(original)
+++ SVN-PropDB/lib/Prophet/Handle.pm	Sat Mar 29 22:12:13 2008
@@ -67,6 +67,14 @@
     }
 }
 
+=head2 begin_edit
+
+Starts a new transaction within the replica's backend database. Sets L</current_edit> to that edit object.
+
+Returns $self->current_edit.
+
+=cut
+
 sub begin_edit {
     my $self = shift;
     my $fs   = $self->repo_handle->fs;
@@ -74,6 +82,12 @@
     return $self->current_edit;
 }
 
+=head2 commit_edit
+
+Finalizes L</current_edit> and sets the 'svn:author' change-prop to the current user.
+
+=cut
+
 sub commit_edit {
     my $self = shift;
     my $txn  = shift;
@@ -84,6 +98,15 @@
 }
 
 
+=head2 integrate_changeset L<Prophet::ChangeSet>
+
+Given a L<Prophet::ChangeSet>, integrates each and every change within that changeset into the handle's replica.
+
+This routine also records that we've seen this changeset (and hence everything before it) from both the peer who sent it to us AND the replica who originally created it.
+
+
+=cut
+
 sub integrate_changeset {
     my $self      = shift;
     my $changeset = shift;
@@ -132,7 +155,15 @@
     }
 }
 
+=head2 create_node { type => $TYPE, uuid => $uuid, props => { key-value pairs }}
+
+Create a new record of type C<$type> with uuid C<$uuid>  within the current replica.
+
+Sets the record's properties to the key-value hash passed in as the C<props> argument.
 
+If called from within an edit, it uses the current edit. Otherwise it manufactures and finalizes one of its own.
+
+=cut
 
 sub create_node {
     my $self = shift;
@@ -169,6 +200,14 @@
     }
 }
 
+=head2 delete_node {uuid => $uuid, type => $type }
+
+Deletes the node C<$uuid> of type C<$type> from the current replica. 
+
+Manufactures its own new edit if C<$self->current_edit> is undefined.
+
+=cut
+
 sub delete_node {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, type => 1 } );
@@ -181,6 +220,15 @@
     return 1;
 }
 
+=head2 set_node_props { uuid => $uuid, type => $type, props => {hash of kv pairs }}
+
+
+Updates the record of type C<$type> with uuid C<$uuid> to set each property defined by the props hash. It does NOT alter any property not defined by the props hash.
+
+Manufactures its own current edit if none exists.
+
+=cut
+
 sub set_node_props {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, props => 1, type => 1 } );
@@ -198,6 +246,21 @@
 
 }
 
+=head2 get_node_props {uuid => $uuid, type => $type, root => $root }
+
+Returns a hashref of all properties for the record of type $type with uuid C<$uuid>.
+
+'root' is an optional argument which you can use to pass in an alternate historical version of the replica to inspect.  Code to look at the immediately previous version of a record might look like:
+
+    $handle->get_node_props(
+        type => $record->type,
+        uuid => $record->uuid,
+        root => $self->repo_handle->fs->revision_root( $self->repo_handle->fs->youngest_rev - 1 )
+    );
+
+
+=cut
+
 sub get_node_props {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, type => 1, root => undef } );
@@ -205,6 +268,12 @@
     return $root->node_proplist( $self->file_for( uuid => $args{'uuid'}, type => $args{'type'} ) );
 }
 
+=head2 file_for { uuid => $UUID, type => $type }
+
+Returns a file path within the repository (starting from the root)
+
+=cut
+
 sub file_for {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, type => 1 } );
@@ -216,6 +285,12 @@
 
 our $MERGETICKET_METATYPE = '_merge_tickets';
 
+=head2 last_changeset_from_source L<Prophet::Sync::Source>
+
+Given a L<Prophet::Sync::Source>, returns the last changeset sequence number we've seen from that remote source's UUID.
+
+=cut
+
 sub last_changeset_from_source {
     my $self = shift;
     my ($source)  = validate_pos( @_, { isa => 'Prophet::Sync::Source' } );
@@ -224,6 +299,15 @@
 
 }
 
+=head2 record_changeset_integration L<Prophet::ChangeSet>
+
+This routine records the immediately upstream and original source
+uuid and sequence numbers for this changeset. Prophet uses this
+data to make sane choices about later replay and merge operations
+
+
+=cut
+
 sub record_changeset_integration {
     my $self = shift;
     my ($changeset) = validate_pos( @_, { isa => 'Prophet::ChangeSet' } );

Modified: SVN-PropDB/lib/Prophet/Sync/Source/SVN/ReplayEditor.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Sync/Source/SVN/ReplayEditor.pm	(original)
+++ SVN-PropDB/lib/Prophet/Sync/Source/SVN/ReplayEditor.pm	Sat Mar 29 22:12:13 2008
@@ -99,7 +99,7 @@
     $self->{'paths'}->{$path}->{fs} = 'add_file';
 }
 
-=head2 add_file ($path, $parent_baton, $copy_path, $copy_revision, $dir_pool, $child_baton) 
+=head2 add_directory ($path, $parent_baton, $copy_path, $copy_revision, $dir_pool, $child_baton) 
 
 Called whenever a directory is added within an edit.
 
@@ -195,7 +195,7 @@
     };
 }
 
-=head2 change_file_prop ($baton, $name, $value,$pool)
+=head2 change_dir_prop ($baton, $name, $value,$pool)
 
 Called by Subversion when a directory property changes. All Subversion
 tells us is that 'the current node's property called $name has



More information about the Bps-public-commit mailing list