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

sartak at bestpractical.com sartak at bestpractical.com
Wed Jul 16 18:55:33 EDT 2008


Author: sartak
Date: Wed Jul 16 18:55:30 2008
New Revision: 14177

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

Log:
 r64449 at onn:  sartak | 2008-07-16 17:17:51 -0400
 Add a "force" parameter which is required for merging between different databases


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 16 18:55:30 2008
@@ -45,6 +45,7 @@
     $target->import_changesets(
         from  => $source,
         resdb => $self->app_handle->resdb_handle,
+        force => $self->has_arg('force'),
         ( $resolver ? (resolver_class => $resolver) : () ),
     );
 }

Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Wed Jul 16 18:55:30 2008
@@ -128,7 +128,8 @@
             resolver           => { optional => 1 },
             resolver_class     => { optional => 1 },
             conflict_callback  => { optional => 1 },
-            reporting_callback => { optional => 1 }
+            reporting_callback => { optional => 1 },
+            force              => { optional => 1 },
         }
     );
 
@@ -136,6 +137,7 @@
 
     $source->traverse_new_changesets(
         for      => $self,
+        force    => $args{'force'},
         callback => sub {
             $self->integrate_changeset(
                 changeset          => $_[0],
@@ -410,13 +412,17 @@
         @_,
         {   for      => { isa => 'Prophet::Replica' },
             callback => 1,
+            force    => 0,
         }
     );
 
     if ( $self->db_uuid && $args{for}->db_uuid && $self->db_uuid ne $args{for}->db_uuid ) {
-
-        #warn "HEY. You should not be merging between two replicas with different database uuids";
-        # XXX TODO
+        if ($args{force}) {
+            warn "You are merging two different databases! This is highly unusual.";
+        }
+        else {
+            confess "You are trying to merge two different databases! If you really want to do this, try adding a --force argument.";
+        }
     }
 
 



More information about the Bps-public-commit mailing list