[Bps-public-commit] SD branch, master, updated. d6da3a5a36ffb438709dca0fa898b57290de2122
jesse
jesse at bestpractical.com
Wed May 27 14:42:05 EDT 2009
The branch, master has been updated
via d6da3a5a36ffb438709dca0fa898b57290de2122 (commit)
via 00a3e26b1b315974f0a8b677e8836f43a4727f3f (commit)
from 1214ae98a1ce7ed24124c9ca8fc6899f094e72bd (commit)
Summary of changes:
lib/App/SD/Replica/hm.pm | 10 ++++++----
lib/App/SD/Replica/hm/PullEncoder.pm | 23 ++++++++++++++---------
lib/App/SD/Replica/hm/PushEncoder.pm | 1 -
lib/App/SD/Replica/trac/PullEncoder.pm | 1 -
t/sd-hm/push-reporter-pro.t | 3 +--
5 files changed, 21 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit 00a3e26b1b315974f0a8b677e8836f43a4727f3f
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue May 26 23:19:49 2009 -0400
Looks like the hm replica type passes all tests now. need more tests
diff --git a/lib/App/SD/Replica/hm.pm b/lib/App/SD/Replica/hm.pm
index 4e5722b..c1592c3 100644
--- a/lib/App/SD/Replica/hm.pm
+++ b/lib/App/SD/Replica/hm.pm
@@ -97,10 +97,12 @@ sub user_info {
sub _user_info {
my $self = shift;
- my %args = @_;
- my $status = $self->hm->act( 'SearchUser', %args, );
- die $status->{'error'} unless $status->{'success'};
- return $status->{'content'}{'search'}[0] || {};
+ my $key = shift;
+ my $value = shift;
+ return undef unless $value;
+ my $status = $self->hm->search('User', $key => $value);
+ die $status->{'error'} unless $status->[0]->{'id'};
+ return $status->[0];
}
memoize '_user_info';
diff --git a/lib/App/SD/Replica/hm/PullEncoder.pm b/lib/App/SD/Replica/hm/PullEncoder.pm
index f8d3db9..837b432 100644
--- a/lib/App/SD/Replica/hm/PullEncoder.pm
+++ b/lib/App/SD/Replica/hm/PullEncoder.pm
@@ -101,7 +101,7 @@ sub find_matching_transactions {
# Skip things we've pushed
next if $self->sync_source->foreign_transaction_originated_locally( $txn->{'id'}, $args{ticket}->{id} );
- $txn->{history_entries}
+ $txn->{history_entries}
= $self->sync_source->hm->search( 'TaskHistory', transaction_id => $txn->{'id'} );
$txn->{email_entries}
= $self->sync_source->hm->search( 'TaskEmail', transaction_id => $txn->{'id'} );
@@ -120,15 +120,16 @@ sub add_prop_change {
my $self = shift;
my %args = validate( @_, { history_entry => 1, previous_state => 1, change => 1 } );
- my $field = $args{'history_entry'}{'field'};
- my $old = $args{'history_entry'}{'old_value'};
- my $new = $args{'history_entry'}{'new_value'};
+
+ my $field = $args{'history_entry'}{'field'} ||'';
+ my $old = $args{'history_entry'}{'old_value'} ||'';
+ my $new = $args{'history_entry'}{'new_value'} ||'';
if ( $args{'previous_state'}->{$field} eq $new ) {
$args{'previous_state'}->{$field} = $old;
} else {
$args{'previous_state'}->{$field} = $old;
- warn $args{'previous_state'}->{$field} . " != " . $new . "\n\n";
+ warn "$field: ". $args{'previous_state'}->{$field} . " != " . $new . "\n\n";
}
$args{change}->add_prop_change( name => $field, old => $old, new => $new );
@@ -191,12 +192,16 @@ sub translate_props {
next if ( $prop->name eq '_delete' );
if ( $prop->name =~ /^(?:reporter|owner|next_action_by)$/ ) {
- $prop->old_value(
- $self->sync_source->user_info( id => $prop->old_value )->{'email'} );
- $prop->new_value(
- $self->sync_source->user_info( id => $prop->new_value )->{'email'} );
+ $prop->old_value( $self->sync_source->user_info( id => $prop->old_value )->{'email'} ) if ($prop->old_value);
+ $prop->new_value( $self->sync_source->user_info( id => $prop->new_value )->{'email'} ) if ($prop->new_value);
}
+ if ($prop->name =~ /^(?:due|completed_at|created_at)$/) {
+ $prop->old_value(App::SD::Util::string_to_datetime($prop->old_value)."");
+ $prop->new_value(App::SD::Util::string_to_datetime($prop->new_value)."");
+
+ }
+
# XXX, TODO, FIXME: this doesn't work any more as id stored as SOURCE_UUID-id property
if ( $prop->name eq 'id' ) {
$prop->old_value( $prop->old_value . '@' . $changeset->original_source_uuid )
diff --git a/lib/App/SD/Replica/hm/PushEncoder.pm b/lib/App/SD/Replica/hm/PushEncoder.pm
index 352da2b..83eaae4 100644
--- a/lib/App/SD/Replica/hm/PushEncoder.pm
+++ b/lib/App/SD/Replica/hm/PushEncoder.pm
@@ -17,7 +17,6 @@ sub integrate_ticket_create {
= validate_pos( @_, { isa => 'Prophet::Change' }, { isa => 'Prophet::ChangeSet' } );
# Build up a ticket object out of all the record's attributes
-
my %args = (
owner => 'me',
group => 0,
diff --git a/lib/App/SD/Replica/trac/PullEncoder.pm b/lib/App/SD/Replica/trac/PullEncoder.pm
index 8470491..d1d781c 100644
--- a/lib/App/SD/Replica/trac/PullEncoder.pm
+++ b/lib/App/SD/Replica/trac/PullEncoder.pm
@@ -5,7 +5,6 @@ extends 'App::SD::ForeignReplica::PullEncoder';
use Params::Validate qw(:all);
use Memoize;
use Time::Progress;
-use DateTime;
has sync_source => (
isa => 'App::SD::Replica::trac',
diff --git a/t/sd-hm/push-reporter-pro.t b/t/sd-hm/push-reporter-pro.t
index 4f4e05e..00f1b1d 100644
--- a/t/sd-hm/push-reporter-pro.t
+++ b/t/sd-hm/push-reporter-pro.t
@@ -44,7 +44,6 @@ diag($sd_hm_url);
flush_sd();
my ($luid, $uuid) = create_ticket_ok(qw(--summary YATTA --status new --reporter test at localhost));
my ($ret, $out, $err) = run_script( 'sd', ['push', '--to', $sd_hm_url] );
-
my $task = load_new_hm_task();
is $task->requestor->email, 'onlooker at example.com', 'correct email';
@@ -60,7 +59,7 @@ diag("non pro have no right to change requestor");
my ($luid, $uuid) = create_ticket_ok(qw(--summary YATTA --status new --reporter onlooker at example.com));
update_ticket_ok($uuid, qw(--reporter test at localhost));
my ($ret, $out, $err) = run_script( 'sd', ['push', '--to', $sd_hm_url] );
-
+ diag($out,$err);
my $task = load_new_hm_task();
is $task->requestor->email, 'onlooker at example.com', 'correct email';
commit d6da3a5a36ffb438709dca0fa898b57290de2122
Merge: 00a3e26... 1214ae9...
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed May 27 10:29:52 2009 -0400
Merge branch 'master' of fsck.com:/git/sd
* 'master' of fsck.com:/git/sd:
attachment pull for trac
sign in stuff for gcode push
push for gcode initially works except the sign in part
small fixes for gcode
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list