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

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 24 01:08:13 EDT 2008


Author: sartak
Date: Thu Jul 24 01:08:13 2008
New Revision: 14459

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Replica.pm
   Prophet/trunk/t/publish-pull.t

Log:
 r64982 at onn:  sartak | 2008-07-24 01:07:41 -0400
 When creating a new replica from another, copy the database uuid


Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Thu Jul 24 01:08:13 2008
@@ -149,6 +149,13 @@
 
     my $source = $args{'from'};
 
+    # they have no changes, that means they're probably creating a new replica
+    # of a database, so copy the db_uuid
+    if ($self->latest_sequence_no == 0) {
+        my $uuid = $source->db_uuid;
+        $self->set_db_uuid($uuid) if $uuid;
+    }
+
     $source->traverse_new_changesets(
         for      => $self,
         force    => $args{'force'},

Modified: Prophet/trunk/t/publish-pull.t
==============================================================================
--- Prophet/trunk/t/publish-pull.t	(original)
+++ Prophet/trunk/t/publish-pull.t	Thu Jul 24 01:08:13 2008
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Prophet::Test tests => 8;
+use Prophet::Test tests => 10;
 use Test::Exception;
 use File::Temp 'tempdir';
 use Path::Class;
@@ -34,10 +34,9 @@
     run_output_matches( 'prophet', [qw(search --type Bug --regex .)], [qr/new/], "publish database uuid intuition works" );
 };
 
-TODO: {
-    local $TODO = "force currently required because db_uuid generation happens too early";
-    as_david {
-        run_ok( 'prophet', ['pull', '--from', "file:$path"] );
-    };
+as_david {
+    run_ok( 'prophet', ['pull', '--from', "file:$path"] );
 };
 
+is(database_uuid_for('alice'), database_uuid_for('david'), "pull propagated the database uuid properly");
+isnt(replica_uuid_for('alice'), replica_uuid_for('david'), "pull created a new replica uuid");



More information about the Bps-public-commit mailing list