[Bps-public-commit] SD - A distributed issue tracker branch, master, updated. e988a91a5b8d81345f94abcf54b7ec3502299e11

jesse jesse at bestpractical.com
Mon Jan 26 12:54:40 EST 2009


The branch, master has been updated
       via  e988a91a5b8d81345f94abcf54b7ec3502299e11 (commit)
       via  9497eab797f3896b28444b267dfd3b84ab036185 (commit)
      from  b97c04c4a197f419eab45688b4156a65ccb6a44e (commit)

Summary of changes:
 lib/App/SD/ForeignReplica.pm         |    8 ++++----
 lib/App/SD/Replica/hm/PushEncoder.pm |    4 ++++
 t/sd-hm/comments.t                   |   15 ++++++++++-----
 3 files changed, 18 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 9497eab797f3896b28444b267dfd3b84ab036185
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Jan 26 12:49:44 2009 -0500

    Don't try to comment on tickets by id and call it commenting by uuid

diff --git a/t/sd-hm/comments.t b/t/sd-hm/comments.t
index 3a5fdfa..07b1561 100644
--- a/t/sd-hm/comments.t
+++ b/t/sd-hm/comments.t
@@ -39,22 +39,27 @@ $task->create(
     description => '',
 );
 
+
 my ($yatta_uuid, $yatta_id);
 {
     diag($sd_hm_url);
     my ($ret, $out, $err) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] );
-    run_output_matches( 'sd', [qw(ticket list --regex .)], [qr/(.*?)(?{ $yatta_uuid = $1 }) YATTA (.*)/] );
-    ( $ret, $out, $err ) = run_script( 'sd', [ qw(ticket show --batch --id), $yatta_uuid ] );
-    $yatta_id = $1 if $out =~ /^id: (\d+) /m;
+    run_output_matches( 'sd', [qw(ticket list --regex .)], [qr/(.*?)(?{ $yatta_id = $1 }) YATTA (.*)/] );
+    ( $ret, $out, $err ) = run_script( 'sd', [ qw(ticket show --batch --id), $yatta_id ] );
+    if ($out =~ /^id: (.*) \((.*)\)$/m) {
+        $yatta_id = $1;
+        $yatta_uuid = $2;
+    } else {
+        die "Couldn't parse ticket show --batch output for YATTA's id\n".$out;
+    }
 }
-
 my ($comment_id, $comment_uuid) = create_ticket_comment_ok(
     '--uuid', $yatta_uuid, '--content',
     "'This is a test'"
 );
+
 {
     my ( $ret, $out, $err ) = run_script( 'sd', [ 'push','--to', $sd_hm_url ] );
-
     my $task = BTDT::Model::Task->new( current_user => $GOODUSER );
     ok( $task->load_by_cols( summary => 'YATTA' ), "loaded a task" );
     my $comments = $task->comments;

commit e988a91a5b8d81345f94abcf54b7ec3502299e11
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Jan 26 12:50:16 2009 -0500

    Get rid of the concept of a state database in favor of using the namespaced store/fetch_local_metadata

diff --git a/lib/App/SD/ForeignReplica.pm b/lib/App/SD/ForeignReplica.pm
index 698bb53..131869f 100644
--- a/lib/App/SD/ForeignReplica.pm
+++ b/lib/App/SD/ForeignReplica.pm
@@ -47,7 +47,7 @@ sub record_pushed_transaction {
     my %args = validate( @_,
         { transaction => 1, changeset => { isa => 'Prophet::ChangeSet' }, record => 1 } );
 
-    $self->state_handle->store_local_metadata(
+    $self->store_local_metadata(
         "foreign-txn-from-".$self->uuid . '-record-'.$args{record}. '-txn-' . $args{transaction} => 
         join( ':',
             $args{changeset}->original_source_uuid,
@@ -76,7 +76,7 @@ remote replica when doing a subsequent pull
 sub foreign_transaction_originated_locally {
     my $self = shift;
     my ($id, $record) = validate_pos( @_, 1, 1);
-    return $self->state_handle->fetch_local_metadata("foreign-txn-from-". $self->uuid .'-record-'.$record. '-txn-' .$id );
+    return $self->fetch_local_metadata("foreign-txn-from-". $self->uuid .'-record-'.$record. '-txn-' .$id );
 }
 
 sub traverse_changesets {
@@ -120,7 +120,7 @@ sub _lookup_uuid_for_remote_id {
 
 
 
-    return $self->state_handle->fetch_local_metadata('local_uuid_for_'.  
+    return $self->fetch_local_metadata('local_uuid_for_'.  
         $self->uuid_for_url( $self->remote_url . $self->remote_uri_path_for_id($id))
     );
 }
@@ -128,7 +128,7 @@ sub _lookup_uuid_for_remote_id {
 sub _set_uuid_for_remote_id {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, remote_id => 1 } );
-    return $self->state_handle->store_local_metadata('local_uuid_for_'.
+    return $self->store_local_metadata('local_uuid_for_'.
         $self->uuid_for_url(
                   $self->remote_url
                 . $self->remote_uri_path_for_id( $args{'remote_id'} )
diff --git a/lib/App/SD/Replica/hm/PushEncoder.pm b/lib/App/SD/Replica/hm/PushEncoder.pm
index dea7cb3..f093e13 100644
--- a/lib/App/SD/Replica/hm/PushEncoder.pm
+++ b/lib/App/SD/Replica/hm/PushEncoder.pm
@@ -13,6 +13,8 @@ sub integrate_changes {
         @_, { isa => 'Prophet::ChangeSet' }
     );
 
+    return if $self->sync_source->has_seen_changeset($changeset);
+
     my @changes = $changeset->changes;
     foreach my $change ( splice @changes ) {
         # don't push internal records
@@ -178,8 +180,10 @@ sub integrate_comment {
 
     my %props = map { $_->name => $_->new_value } $change->prop_changes;
 
+
     my $ticket_id = $self->sync_source->remote_id_for_uuid( $props{'ticket'} )
         or die "Couldn't get remote id of SD ticket";
+    
 
     my $email = $self->comment_as_email( \%props );
     my $status = $self->sync_source->hm->act(

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list