[Bps-public-commit] r14429 - in Prophet/trunk: . lib/Prophet/CLI/Command

sartak at bestpractical.com sartak at bestpractical.com
Wed Jul 23 07:05:22 EDT 2008


Author: sartak
Date: Wed Jul 23 07:05:20 2008
New Revision: 14429

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm
   Prophet/trunk/lib/Prophet/CLI/Command/Pull.pm
   Prophet/trunk/lib/Prophet/CLI/Command/Push.pm
   Prophet/trunk/lib/Prophet/Replica.pm

Log:
 r64870 at onn:  sartak | 2008-07-23 06:13:56 -0400
 Allow alternate urls for a repository (though this is currently for internal use only)


Modified: Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm	Wed Jul 23 07:05:20 2008
@@ -3,11 +3,24 @@
 extends 'Prophet::CLI::Command';
 
 sub run {
-
     my $self = shift;
 
-    my $source = Prophet::Replica->new( { url => $self->arg('from') } );
-    my $target = Prophet::Replica->new( { url => $self->arg('to') } );
+    my (@alt_from, @alt_to);
+
+    if ($self->has_arg('db_uuid')) {
+        push @alt_from, join '/', $self->arg('from'), $self->arg('db_uuid');
+        push @alt_to,   join '/', $self->arg('to'),   $self->arg('db_uuid');
+    }
+
+    my $source = Prophet::Replica->new(
+        url       => $self->arg('from'),
+        _alt_urls => \@alt_from,
+    );
+
+    my $target = Prophet::Replica->new(
+        url       => $self->arg('to'),
+        _alt_urls => \@alt_to,
+    );
 
     $target->import_resolutions_from_remote_replica(
         from  => $source,

Modified: Prophet/trunk/lib/Prophet/CLI/Command/Pull.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Pull.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Pull.pm	Wed Jul 23 07:05:20 2008
@@ -10,6 +10,8 @@
     $self->set_arg(to => $self->cli->app_handle->default_replica_type.":file://"
 .$self->cli->app_handle->handle->fs_root);
 
+    $self->set_arg(db_uuid => $self->app_handle->handle->db_uuid);
+
     super();
 };
 

Modified: Prophet/trunk/lib/Prophet/CLI/Command/Push.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Push.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Push.pm	Wed Jul 23 07:05:20 2008
@@ -10,6 +10,8 @@
     $self->set_arg(from => $self->app_handle->default_replica_type.":file://".$s
 elf->app_handle->handle->fs_root);
 
+    $self->set_arg(db_uuid => $self->app_handle->handle->db_uuid);
+
     super();
 };
 

Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Wed Jul 23 07:05:20 2008
@@ -35,6 +35,12 @@
     isa => 'Str',
 );
 
+has _alt_urls => (
+    is      => 'rw',
+    isa     => 'ArrayRef',
+    default => sub { [] },
+);
+
 use constant state_db_uuid => 'state';
 use Module::Pluggable search_path => 'Prophet::Replica', sub_name => 'core_replica_types', require => 0, except => qr/Prophet::Replica::(.*)::/;
 



More information about the Bps-public-commit mailing list