[Bps-public-commit] r13912 - Prophet/trunk/lib/Prophet

jesse at bestpractical.com jesse at bestpractical.com
Wed Jul 9 12:46:24 EDT 2008


Author: jesse
Date: Wed Jul  9 12:46:24 2008
New Revision: 13912

Modified:
   Prophet/trunk/lib/Prophet/App.pm
   Prophet/trunk/lib/Prophet/ForeignReplica.pm
   Prophet/trunk/lib/Prophet/Replica.pm

Log:
* Small cleanups toward getting SD syncing of RT happier

Modified: Prophet/trunk/lib/Prophet/App.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/App.pm	(original)
+++ Prophet/trunk/lib/Prophet/App.pm	Wed Jul  9 12:46:24 2008
@@ -58,6 +58,7 @@
     Module::Pluggable->import( search_path => $replica_class, sub_name => 'app_replica_types', require => 0, except => qr/$except/);
     for my $package ( $self->app_replica_types) {
         $package->require;
+        next unless $package->can('scheme');
         Prophet::Replica->register_replica_scheme(scheme => $package->scheme, class => $package) 
     }
 }

Modified: Prophet/trunk/lib/Prophet/ForeignReplica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/ForeignReplica.pm	(original)
+++ Prophet/trunk/lib/Prophet/ForeignReplica.pm	Wed Jul  9 12:46:24 2008
@@ -62,7 +62,7 @@
     # XXX belongs to some CLI callback
     use Term::ReadKey;
     local $| = 1;
-    if ($username) {
+    unless ($username) {
         print "Username for $uri: ";
         ReadMode 1;
         $username = ReadLine 0;

Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Wed Jul  9 12:46:24 2008
@@ -308,14 +308,20 @@
     $self->log("Checking to see if we've ever seen changeset " .$changeset->original_sequence_no . " from ".substr($changeset->original_source_uuid,0,6));
 
     # If the changeset originated locally, we never want it
-    return 1 if $changeset->original_source_uuid eq $self->uuid;
-
+    if  ($changeset->original_source_uuid eq $self->uuid ) {
+        
+        $self->log("\t  - We have. (It originated locally)");
+        return 1 
+    }
     # Otherwise, if the we have a merge ticket from the source, we don't want the changeset
-    my $last = $self->last_changeset_from_source( $changeset->original_source_uuid );
-
     # if the source's sequence # is >= the changeset's sequence #, we can safely skip it
-    return 1 if ( $last >= $changeset->original_sequence_no );
-    return undef;
+    elsif ( $self->last_changeset_from_source( $changeset->original_source_uuid ) >= $changeset->original_sequence_no ) {
+        $self->log("\t  - We have seen this or a more recent changeset from remote.");
+        return 1;
+    } else {
+        $self->log("\t  - We have not.");
+        return undef;
+    }
 }
 
 =head2 changeset_will_conflict Prophet::ChangeSet
@@ -353,6 +359,8 @@
 
     return undef unless $conflict->has_conflicting_changes;
 
+    $self->log("Conflicting changeset: ".YAML::Dump($conflict));
+
     return $conflict;
 
 }
@@ -757,8 +765,6 @@
     $self->_integrate_change($_, $changeset) for ( $changeset->changes );
 
 }
-
-
 sub _integrate_change {
     my ($self, $change, $changeset) = validate_pos(@_, {isa => 'Prophet::Replica'}, { isa => 'Prophet::Change'}, { isa => 'Prophet::ChangeSet'} );
 



More information about the Bps-public-commit mailing list