[Bps-public-commit] Prophet branch, master, updated. 95b9c27ff3ea50a912c464e3ba4a8b61697ff64b
jesse
jesse at bestpractical.com
Tue Jun 2 19:49:46 EDT 2009
The branch, master has been updated
via 95b9c27ff3ea50a912c464e3ba4a8b61697ff64b (commit)
via 39b94c8f4d23486c751848ac65b209566a96c995 (commit)
from 4068969a90275863f3217dd07bc88e80f7d1264c (commit)
Summary of changes:
lib/Prophet/Replica.pm | 39 +++++----------------------------------
t/simple-push.t | 10 ++++------
2 files changed, 9 insertions(+), 40 deletions(-)
- Log -----------------------------------------------------------------
commit 39b94c8f4d23486c751848ac65b209566a96c995
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Jun 2 19:47:57 2009 -0400
Remove "traverse_new_changesets" as it was a single-use one-trick subroutine.
diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index d2fca7b..0d8b5b8 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -162,12 +162,13 @@ sub import_changesets {
);
my $source = $args{'from'};
+
+ $source->_check_db_uuids_on_merge(for => $self, force => $args{'force'});
warn "The source (@{[$source->url]}) does not exist" unless ($source->replica_exists);
- $source->traverse_new_changesets(
- for => $self,
- force => $args{'force'},
+ $source->traverse_changesets(
+ after => $self->last_changeset_from_source( $self->uuid ),
callback => sub {
$self->integrate_changeset(
changeset => $_[0],
@@ -432,36 +433,6 @@ sub conflicts_from_changeset {
return $conflict;
}
-=head3 traverse_new_changesets ( for => $replica, callback => sub { my $changeset = shift; ... } )
-
-Traverse the new changesets for C<$replica> and call C<callback> for each new
-changeset.
-
-This also provide hinting callbacks for the caller to know in advance how many
-changesets are there for traversal.
-
-=cut
-
-sub traverse_new_changesets {
- my $self = shift;
- my %args = validate(
- @_,
- { for => { isa => 'Prophet::Replica' },
- callback => 1,
- force => 0,
- }
- );
-
- $self->_check_db_uuids_on_merge(for => $args{for}, force => $args{'force'});
-
- $self->traverse_changesets(
- after => $args{for}->last_changeset_from_source( $self->uuid ),
- callback => sub {
- $args{callback}->( $_[0] ) ;# if $self->should_send_changeset( changeset => $_[0], to => $args{for});
- }
- );
-}
-
sub _check_db_uuids_on_merge {
my $self = shift;
my %args = validate( @_,
@@ -509,7 +480,7 @@ Fetch all changesets from this replica after the local sequence number SEQUENCE_
Returns a reference to an array of L<Prophet::ChangeSet/> objects.
-See also L<traverse_new_changesets> for replica implementations to provide
+See also L<traverse_changesets> for replica implementations to provide
streamly interface.
=cut
diff --git a/t/simple-push.t b/t/simple-push.t
index e51696e..a2d529e 100644
--- a/t/simple-push.t
+++ b/t/simple-push.t
@@ -75,9 +75,8 @@ as_bob {
};
my $changesets;
-$bob->traverse_new_changesets(
- for => $alice,
- force => 1,
+$bob->traverse_changesets(
+ after => $alice->last_changeset_from_source($bob->uuid),
callback => sub {
my $cs = shift;
return unless $bob->should_send_changeset( changeset => $cs, to => $alice);
@@ -157,9 +156,8 @@ as_bob {
};
my $new_changesets;
-$bob->traverse_new_changesets(
- for => $alice,
- force => 1,
+$bob->traverse_changesets(
+ after => $alice->last_changeset_from_source($bob->uuid),
callback => sub {
my $cs = shift;
return unless $cs->has_changes, push @{$new_changesets}, $cs->as_hash;
commit 95b9c27ff3ea50a912c464e3ba4a8b61697ff64b
Merge: 39b94c8... 4068969...
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Jun 2 19:49:33 2009 -0400
Merge branch 'master' of fsck.com:/git/prophet
* 'master' of fsck.com:/git/prophet:
add last_script_... help subs for test
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list