[Bps-public-commit] r11529 - in SVN-PropDB: . bin doc lib/Prophet lib/Prophet/Replica/RT lib/Prophet/Replica/SVN lib/Prophet/Sync lib/Prophet/Sync/Source t

jesse at bestpractical.com jesse at bestpractical.com
Sat Apr 5 05:36:39 EDT 2008


Author: jesse
Date: Sat Apr  5 05:36:37 2008
New Revision: 11529

Added:
   SVN-PropDB/lib/Prophet/Replica/
      - copied from r11526, /SVN-PropDB/lib/Prophet/Sync/Source/
   SVN-PropDB/lib/Prophet/Replica.pm
      - copied, changed from r11526, /SVN-PropDB/lib/Prophet/Sync/Source.pm
Removed:
   SVN-PropDB/lib/Prophet/Sync/Source/
   SVN-PropDB/lib/Prophet/Sync/Source.pm
Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/bin/prophet-merge
   SVN-PropDB/bin/sd
   SVN-PropDB/doc/todo
   SVN-PropDB/lib/Prophet/CLI.pm
   SVN-PropDB/lib/Prophet/Replica/RT.pm
   SVN-PropDB/lib/Prophet/Replica/RT/PullEncoder.pm
   SVN-PropDB/lib/Prophet/Replica/SVN.pm
   SVN-PropDB/lib/Prophet/Replica/SVN/ReplayEditor.pm
   SVN-PropDB/lib/Prophet/Replica/SVN/Util.pm
   SVN-PropDB/lib/Prophet/Test.pm
   SVN-PropDB/t/real-conflicting-merge.t
   SVN-PropDB/t/simple-conflicting-merge.t
   SVN-PropDB/t/simple-push.t

Log:
 r29230 at 68-247-170-82:  jesse | 2008-04-04 23:36:21 -1000
 Sync::Source -> Replica
 


Modified: SVN-PropDB/bin/prophet-merge
==============================================================================
--- SVN-PropDB/bin/prophet-merge	(original)
+++ SVN-PropDB/bin/prophet-merge	Sat Apr  5 05:36:37 2008
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Prophet::Sync::Source::SVN;
+use Prophet::Replica::SVN;
 use Params::Validate;
 use Getopt::Long;
 use Prophet::CLI;
@@ -14,8 +14,8 @@
 GetOptions( $opts, 'from=s', 'to=s', 'prefer=s');
 validate_options($opts);
 
-my $source = Prophet::Sync::Source->new( { url => $opts->{'from'} } );
-my $target = Prophet::Sync::Source->new( { url => $opts->{'to'} } );
+my $source = Prophet::Replica->new( { url => $opts->{'from'} } );
+my $target = Prophet::Replica->new( { url => $opts->{'to'} } );
 
 if ( $target->uuid eq $source->uuid ) {
 fatal_error( "You appear to be trying to merge two identical replicas. "

Modified: SVN-PropDB/bin/sd
==============================================================================
--- SVN-PropDB/bin/sd	(original)
+++ SVN-PropDB/bin/sd	Sat Apr  5 05:36:37 2008
@@ -135,8 +135,8 @@
 
 
 return;
-    my $source = Prophet::Sync::Source->new( { url => 'file://'.$CLI->handle->repo_path } );
-    my $target = Prophet::Sync::Source->new( { url => $url });
+    my $source = Prophet::Replica->new( { url => 'file://'.$CLI->handle->repo_path } );
+    my $target = Prophet::Replica->new( { url => $url });
 #    my $changesets = $source->new_changesets_for($target);
     my $changesets = $source->new_changesets_for($target);
     warn Dumper($changesets); use Data::Dumper;

Modified: SVN-PropDB/doc/todo
==============================================================================
--- SVN-PropDB/doc/todo	(original)
+++ SVN-PropDB/doc/todo	Sat Apr  5 05:36:37 2008
@@ -1,9 +1,9 @@
 Todo
 
     - get a state_db exposed within the RT source
-    - extract the reusable bits of Prophet::Sync::Source::RT to
+    - extract the reusable bits of Prophet::Replica::RT to
             Prophet::Sync::UpstreamSource
-    - implement a simple Prophet::Sync::Source::Hiveminder for "personal tasks only"
+    - implement a simple Prophet::Replica::Hiveminder for "personal tasks only"
     - write tests for RT-prophet-prophet-RT sync
     
     - lunch

Modified: SVN-PropDB/lib/Prophet/CLI.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/CLI.pm	(original)
+++ SVN-PropDB/lib/Prophet/CLI.pm	Sat Apr  5 05:36:37 2008
@@ -10,7 +10,7 @@
 use Prophet::Handle;
 use Prophet::Record;
 use Prophet::Collection;
-use Prophet::Sync::Source;
+use Prophet::Replica;
 
 sub new {
     my $class = shift;
@@ -242,9 +242,9 @@
 
 sub do_push {
     my $self = shift;
-    my $source_me = Prophet::Sync::Source->new( { url => "file://".$self->handle->repo_path } );
+    my $source_me = Prophet::Replica->new( { url => "file://".$self->handle->repo_path } );
     my $other = shift @ARGV;
-    my $source_other = Prophet::Sync::Source->new( { url => $other } );
+    my $source_other = Prophet::Replica->new( { url => $other } );
     my $resdb = $source_me->import_resolutions_from_remote_replica( from => $source_other );
     
     $self->_do_merge( $source_me, $source_other );
@@ -252,9 +252,9 @@
 
 sub do_pull {
     my $self = shift;
-    my $source_me = Prophet::Sync::Source->new( { url => "file://".$self->handle->repo_path } );
+    my $source_me = Prophet::Replica->new( { url => "file://".$self->handle->repo_path } );
     my $other = shift @ARGV;
-    my $source_other = Prophet::Sync::Source->new( { url => $other } );
+    my $source_other = Prophet::Replica->new( { url => $other } );
     my $resdb = $source_me->import_resolutions_from_remote_replica( from => $source_other );
     
     $self->_do_merge( $source_other, $source_me );
@@ -267,12 +267,11 @@
 
     my $opts = $self->args();
 
-    my $source = Prophet::Sync::Source->new( { url => $opts->{'from'} } );
-    my $target = Prophet::Sync::Source->new( { url => $opts->{'to'} } );
+    my $source = Prophet::Replica->new( { url => $opts->{'from'} } );
+    my $target = Prophet::Replica->new( { url => $opts->{'to'} } );
     
     $target->import_resolutions_from_remote_replica( from => $source );
     
-
     $self->_do_merge( $source, $target);
 }
 

Copied: SVN-PropDB/lib/Prophet/Replica.pm (from r11526, /SVN-PropDB/lib/Prophet/Sync/Source.pm)
==============================================================================
--- /SVN-PropDB/lib/Prophet/Sync/Source.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica.pm	Sat Apr  5 05:36:37 2008
@@ -1,7 +1,7 @@
 use warnings;
 use strict;
 
-package Prophet::Sync::Source;
+package Prophet::Replica;
 use base qw/Class::Accessor/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;
@@ -10,7 +10,7 @@
 
 =head1 NAME
 
-Prophet::Sync::Source
+Prophet::Replica
 
 =head1 DESCRIPTION
                         
@@ -50,9 +50,9 @@
 
     # XXX TODO HACK NEED A PROPER WAY TO DETERMINE SYNC SOURCE
     if ( $args->{url} =~ /^rt:/ ) {
-        $class = 'Prophet::Sync::Source::RT';
+        $class = 'Prophet::Replica::RT';
     } else {
-        $class = 'Prophet::Sync::Source::SVN';
+        $class = 'Prophet::Replica::SVN';
     }
     $class->require or die $@;
     bless $self, $class;
@@ -62,7 +62,7 @@
     my $self = shift;
     my %args = validate(
         @_,
-        {   from               => { isa      => 'Prophet::Sync::Source' },
+        {   from               => { isa      => 'Prophet::Replica' },
             resdb              => { optional => 1 },
             resolver           => { optional => 1 },
             resolver_class     => { optional => 1 },
@@ -92,7 +92,7 @@
     my $self = shift;
     my %args = validate(
         @_,
-        {   from              => { isa      => 'Prophet::Sync::Source' },
+        {   from              => { isa      => 'Prophet::Replica' },
             resolver          => { optional => 1 },
             resolver_class    => { optional => 1 },
             conflict_callback => { optional => 1 }
@@ -293,7 +293,7 @@
 }
 
 
-=head2 news_changesets_for Prophet::Sync::Source
+=head2 news_changesets_for Prophet::Replica
 
 Returns the local changesets that have not yet been seen by the replica we're passing in.
 
@@ -301,7 +301,7 @@
 
 sub new_changesets_for {
     my $self = shift;
-    my (  $other ) = validate_pos(@_, { isa => 'Prophet::Sync::Source'});
+    my (  $other ) = validate_pos(@_, { isa => 'Prophet::Replica'});
 
     return [ 
         grep { $self->should_send_changeset( changeset => $_, to => $other ) }
@@ -309,7 +309,7 @@
         ];
 }
 
-=head2 should_send_changeset { to => Prophet::Sync::Source, changeset => Prophet::ChangeSet }
+=head2 should_send_changeset { to => Prophet::Replica, changeset => Prophet::ChangeSet }
 
 Returns true if the replica C<to> hasn't yet seen the changeset C<changeset>
 
@@ -318,7 +318,7 @@
 
 sub should_send_changeset {
     my $self = shift;
-    my %args = validate(@_, { to => { isa => 'Prophet::Sync::Source'}, changeset =>{ isa=> 'Prophet::ChangeSet' }});
+    my %args = validate(@_, { to => { isa => 'Prophet::Replica'}, changeset =>{ isa=> 'Prophet::ChangeSet' }});
     
      return undef if ( $args{'changeset'}->is_nullification || $args{'changeset'}->is_resolution );
      return undef if $args{'to'}->has_seen_changeset($args{'changeset'});

Modified: SVN-PropDB/lib/Prophet/Replica/RT.pm
==============================================================================
--- /SVN-PropDB/lib/Prophet/Sync/Source/RT.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/RT.pm	Sat Apr  5 05:36:37 2008
@@ -1,8 +1,8 @@
 use warnings;
 use strict;
 
-package Prophet::Sync::Source::RT;
-use base qw/Prophet::Sync::Source/;
+package Prophet::Replica::RT;
+use base qw/Prophet::Replica/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;
 use RT::Client::REST       ();
@@ -12,7 +12,7 @@
 use Prophet::Handle;
 use Prophet::ChangeSet;
 use Prophet::Conflict;
-use Prophet::Sync::Source::RT::PullEncoder;
+use Prophet::Replica::RT::PullEncoder;
 use App::Cache;
 
 __PACKAGE__->mk_accessors(qw/prophet_handle ressource is_resdb rt rt_url rt_queue rt_query/);
@@ -425,7 +425,7 @@
 
     my @changesets;
     my %tix;
-    my $recoder = Prophet::Sync::Source::RT::PullEncoder->new( { sync_source => $self } );
+    my $recoder = Prophet::Replica::RT::PullEncoder->new( { sync_source => $self } );
     for my $id ( $self->find_matching_tickets ) {
 
         # XXX: _recode_transactions should ignore txn-id <= $first_rev

Modified: SVN-PropDB/lib/Prophet/Replica/RT/PullEncoder.pm
==============================================================================
--- /SVN-PropDB/lib/Prophet/Sync/Source/RT/PullEncoder.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/RT/PullEncoder.pm	Sat Apr  5 05:36:37 2008
@@ -1,7 +1,7 @@
 use warnings;
 use strict;
 
-package Prophet::Sync::Source::RT::PullEncoder;
+package Prophet::Replica::RT::PullEncoder;
 use base qw/Class::Accessor/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;

Modified: SVN-PropDB/lib/Prophet/Replica/SVN.pm
==============================================================================
--- /SVN-PropDB/lib/Prophet/Sync/Source/SVN.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/SVN.pm	Sat Apr  5 05:36:37 2008
@@ -1,8 +1,8 @@
 use warnings;
 use strict;
 
-package Prophet::Sync::Source::SVN;
-use base qw/Prophet::Sync::Source/;
+package Prophet::Replica::SVN;
+use base qw/Prophet::Replica/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;
 
@@ -11,8 +11,8 @@
 use SVN::Delta;
 
 use Prophet::Handle;
-use Prophet::Sync::Source::SVN::ReplayEditor;
-use Prophet::Sync::Source::SVN::Util;
+use Prophet::Replica::SVN::ReplayEditor;
+use Prophet::Replica::SVN::Util;
 use Prophet::ChangeSet;
 use Prophet::Conflict;
 
@@ -30,8 +30,8 @@
 
 sub _get_ra {
     my $self = shift;
-    my ( $baton, $ref ) = SVN::Core::auth_open_helper( Prophet::Sync::Source::SVN::Util->get_auth_providers );
-    my $config = Prophet::Sync::Source::SVN::Util->svnconfig;
+    my ( $baton, $ref ) = SVN::Core::auth_open_helper( Prophet::Replica::SVN::Util->get_auth_providers );
+    my $config = Prophet::Replica::SVN::Util->svnconfig;
     return SVN::Ra->new( url => $self->url, config => $config, auth => $baton, pool => $self->pool );
 }
 
@@ -87,7 +87,7 @@
     # XXX TODO we should  be using a svn get_log call here rather than simple iteration
     # clkao explains that this won't deal cleanly with cases where there are revision "holes"
     for my $rev ( $first_rev .. $self->ra->get_latest_revnum ) {
-        my $editor = Prophet::Sync::Source::SVN::ReplayEditor->new( _debug => 0 );
+        my $editor = Prophet::Replica::SVN::ReplayEditor->new( _debug => 0 );
         $editor->ra( $self->_get_ra );
         my $pool = SVN::Pool->new_default;
 

Modified: SVN-PropDB/lib/Prophet/Replica/SVN/ReplayEditor.pm
==============================================================================
--- /SVN-PropDB/lib/Prophet/Sync/Source/SVN/ReplayEditor.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/SVN/ReplayEditor.pm	Sat Apr  5 05:36:37 2008
@@ -1,17 +1,17 @@
 use warnings;
 use strict;
 
-package Prophet::Sync::Source::SVN::ReplayEditor;
+package Prophet::Replica::SVN::ReplayEditor;
 use base qw/SVN::Delta::Editor/;
 
 =head1 NAME
 
-Prophet::Sync::Source::SVN::ReplayEditor
+Prophet::Replica::SVN::ReplayEditor
 
 =head1 DESCRIPTION
 
 This class encapsulates a Subversion "replay" editor.  Prophet's
-Subversion synchronization client (L<Prophet::Sync::Source::SVN>)
+Subversion synchronization client (L<Prophet::Replica::SVN>)
 uses it to turn a set of subversion
 deltas into a set of L<Prophet::ChangeSet> objects.
 

Modified: SVN-PropDB/lib/Prophet/Replica/SVN/Util.pm
==============================================================================
--- /SVN-PropDB/lib/Prophet/Sync/Source/SVN/Util.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/SVN/Util.pm	Sat Apr  5 05:36:37 2008
@@ -2,11 +2,11 @@
 use strict;
 
 # XXX CARGO CULTED FROM SVK::Util;
-package Prophet::Sync::Source::SVN::Util;
+package Prophet::Replica::SVN::Util;
 
 =head1 NAME
 
-Prophet::Sync::Source::SVN
+Prophet::Replica::SVN
 
 =head1 DESCRIPTION
 

Modified: SVN-PropDB/lib/Prophet/Test.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test.pm	(original)
+++ SVN-PropDB/lib/Prophet/Test.pm	Sat Apr  5 05:36:37 2008
@@ -269,7 +269,7 @@
 
 sub fetch_newest_changesets {
     my $count = shift;
-    my $source = Prophet::Sync::Source->new( { url => repo_uri_for( $ENV{'PROPHET_USER'} ) } );
+    my $source = Prophet::Replica->new( { url => repo_uri_for( $ENV{'PROPHET_USER'} ) } );
     return @{ $source->fetch_changesets( after => ( replica_last_rev() - $count ) ) };
 
 }

Modified: SVN-PropDB/t/real-conflicting-merge.t
==============================================================================
--- SVN-PropDB/t/real-conflicting-merge.t	(original)
+++ SVN-PropDB/t/real-conflicting-merge.t	Sat Apr  5 05:36:37 2008
@@ -19,7 +19,7 @@
 
     run_ok( 'prophet-node-create', [qw(--type Dummy --ignore yes)], "Created a dummy record" );
 
-    run_ok( 'prophet-merge', [ '--to', repo_uri_for('bob'), '--from', repo_uri_for('alice') ], "Sync ran ok!" );
+    run_ok( 'prophet', ['merge', '--to', repo_uri_for('bob'), '--from', repo_uri_for('alice') ], "Sync ran ok!" );
 
     # check our local replicas
     my ( $ret, $out, $err ) = run_script( 'prophet-node-search', [qw(--type Bug --regex .)] );
@@ -52,10 +52,10 @@
 # This conflict, we can autoresolve
 
 as_bob {
-    use_ok('Prophet::Sync::Source::SVN');
+    use_ok('Prophet::Replica::SVN');
 
-    my $source = Prophet::Sync::Source->new( { url => repo_uri_for('alice') } );
-    my $target = Prophet::Sync::Source->new( { url => repo_uri_for('bob') } );
+    my $source = Prophet::Replica->new( { url => repo_uri_for('alice') } );
+    my $target = Prophet::Replica->new( { url => repo_uri_for('bob') } );
 
     my $conflict_obj;
 
@@ -95,8 +95,8 @@
     check_bob_final_state_ok(@changesets);
 };
 as_alice {
-    my $source = Prophet::Sync::Source->new( { url => repo_uri_for('bob') } );
-    my $target = Prophet::Sync::Source->new( { url => repo_uri_for('alice') } );
+    my $source = Prophet::Replica->new( { url => repo_uri_for('bob') } );
+    my $target = Prophet::Replica->new( { url => repo_uri_for('alice') } );
 
     throws_ok {
         $target->import_changesets( from => $source, );
@@ -123,8 +123,8 @@
 };
 
 as_bob {
-    my $source = Prophet::Sync::Source->new( { url => repo_uri_for('alice') } );
-    my $target = Prophet::Sync::Source->new( { url => repo_uri_for('bob') } );
+    my $source = Prophet::Replica->new( { url => repo_uri_for('alice') } );
+    my $target = Prophet::Replica->new( { url => repo_uri_for('bob') } );
 
     lives_and {
         ok_added_revisions(

Modified: SVN-PropDB/t/simple-conflicting-merge.t
==============================================================================
--- SVN-PropDB/t/simple-conflicting-merge.t	(original)
+++ SVN-PropDB/t/simple-conflicting-merge.t	Sat Apr  5 05:36:37 2008
@@ -55,10 +55,10 @@
     # XXX TODO: this should actually fail right now.
     # in perl code, we're going to run the merge (just as prophet-merge does)
 
-    use_ok('Prophet::Sync::Source::SVN');
+    use_ok('Prophet::Replica::SVN');
 
-    my $source = Prophet::Sync::Source->new( { url => repo_uri_for('alice') } );
-    my $target = Prophet::Sync::Source->new( { url => repo_uri_for('bob') } );
+    my $source = Prophet::Replica->new( { url => repo_uri_for('alice') } );
+    my $target = Prophet::Replica->new( { url => repo_uri_for('bob') } );
 
     my $conflict_obj;
 

Modified: SVN-PropDB/t/simple-push.t
==============================================================================
--- SVN-PropDB/t/simple-push.t	(original)
+++ SVN-PropDB/t/simple-push.t	Sat Apr  5 05:36:37 2008
@@ -24,10 +24,10 @@
 
 };
 
-use_ok('Prophet::Sync::Source::SVN');
+use_ok('Prophet::Replica::SVN');
 
-my $alice = Prophet::Sync::Source->new( { url => repo_uri_for('alice') } );
-my $bob   = Prophet::Sync::Source->new( { url => repo_uri_for('bob') } );
+my $alice = Prophet::Replica->new( { url => repo_uri_for('alice') } );
+my $bob   = Prophet::Replica->new( { url => repo_uri_for('bob') } );
 
 my $changesets = $bob->new_changesets_for($alice);
 



More information about the Bps-public-commit mailing list