[Bps-public-commit] r14068 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Mon Jul 14 12:33:43 EDT 2008


Author: sartak
Date: Mon Jul 14 12:33:30 2008
New Revision: 14068

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

Log:
 r64199 at onn:  sartak | 2008-07-14 11:06:52 -0400
 Small refactor of Merge command


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	Mon Jul 14 12:33:30 2008
@@ -18,37 +18,35 @@
 
 sub _do_merge {
     my ( $self, $source, $target ) = @_;
+
     if ( $target->uuid eq $source->uuid ) {
         $self->fatal_error(
                   "You appear to be trying to merge two identical replicas. "
                 . "Either you're trying to merge a replica to itself or "
-                . "someone did a bad job cloning your database" );
+                . "someone did a bad job cloning your database." );
     }
 
-    my $prefer = $self->arg('prefer') || 'none';
-
     if ( !$target->can_write_changesets ) {
         $self->fatal_error( $target->url
-                . " does not accept changesets. Perhaps it's unwritable or something"
+                . " does not accept changesets. Perhaps it's unwritable."
         );
     }
 
+    my $prefer = $self->arg('prefer') || 'none';
+
+    my $resolver = $ENV{'PROPHET_RESOLVER'}
+                   ? 'Prophet::Resolver::' . $ENV{'PROPHET_RESOLVER'}
+                 : $prefer eq 'to'
+                   ? 'Prophet::Resolver::AlwaysTarget'
+                 : $prefer eq 'from'
+                   ? 'Prophet::Resolver::AlwaysSource'
+                   : ();
+
     $target->import_changesets(
         from  => $source,
         resdb => $self->app_handle->resdb_handle,
-        $ENV{'PROPHET_RESOLVER'}
-        ? ( resolver_class => 'Prophet::Resolver::' . $ENV{'PROPHET_RESOLVER'} )
-        : ( (   $prefer eq 'to'
-                ? ( resolver_class => 'Prophet::Resolver::AlwaysTarget' )
-                : ()
-            ),
-            (   $prefer eq 'from'
-                ? ( resolver_class => 'Prophet::Resolver::AlwaysSource' )
-                : ()
-            )
-        )
+        ( $resolver ? resolver_class => $resolver : () ),
     );
-
 }
 
 __PACKAGE__->meta->make_immutable;



More information about the Bps-public-commit mailing list