[Bps-public-commit] r15067 - in sd/trunk: . lib/App/SD lib/App/SD/CLI/Command lib/App/SD/CLI/Command/Ticket lib/App/SD/Model lib/App/SD/Replica/RT

spang at bestpractical.com spang at bestpractical.com
Tue Aug 12 09:13:15 EDT 2008


Author: spang
Date: Tue Aug 12 09:13:04 2008
New Revision: 15067

Removed:
   sd/trunk/t/00-create.t
Modified:
   sd/trunk/   (props changed)
   sd/trunk/lib/App/SD/CLI/Command/Pull.pm
   sd/trunk/lib/App/SD/CLI/Command/Push.pm
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm
   sd/trunk/lib/App/SD/Model/Ticket.pm
   sd/trunk/lib/App/SD/Record.pm
   sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
   sd/trunk/lib/App/SD/Test.pm
   sd/trunk/t/01-create.t
   sd/trunk/t/sd-attachments.t
   sd/trunk/t/sd-comments.t
   sd/trunk/t/sd-hm.t

Log:
 r47115 at loki:  spang | 2008-07-24 20:36:36 +0100
  r47050 at loki (orig r14432):  cwest | 2008-07-23 17:49:33 +0100
  D8314F5C-58D1-11DD-A02B-20F23D9AEBE7: convert prop(date) to prop(created), provide passive data migration
  r47051 at loki (orig r14433):  cwest | 2008-07-23 18:00:33 +0100
  765019D4-58D7-11DD-B4D0-A1F33D9AEBE7: RT Created property becomes prop(created)
  r47054 at loki (orig r14436):  sunnavy | 2008-07-23 19:06:51 +0100
  added inc
  r47055 at loki (orig r14437):  sunnavy | 2008-07-23 19:11:27 +0100
  we should make 01-dependencies skip if inc/.author isn't there
  r47066 at loki (orig r14448):  cwest | 2008-07-24 01:20:56 +0100
  Be smarter about no-Jifty testing
  r47067 at loki (orig r14449):  cwest | 2008-07-24 01:27:18 +0100
  Use around from Moose
  r47078 at loki (orig r14460):  sartak | 2008-07-24 06:25:31 +0100
   r64985 at onn:  sartak | 2008-07-24 01:25:17 -0400
   Set the default db_uuid so we can avoid having to specify database uuid in push/pull
  
  r47088 at loki (orig r14470):  sartak | 2008-07-24 10:19:10 +0100
   r64991 at onn:  sartak | 2008-07-24 04:26:05 -0400
   Ignore some autogenerated files
  
  r47089 at loki (orig r14471):  sartak | 2008-07-24 10:19:25 +0100
   r65004 at onn:  sartak | 2008-07-24 05:19:03 -0400
   Don't add a "created" property every update (we need to check the record's existing properties)
  
  r47091 at loki (orig r14473):  sartak | 2008-07-24 10:45:18 +0100
   r65009 at onn:  sartak | 2008-07-24 05:45:12 -0400
   Don't try to read the record's properties before it's created, it creates lots of sparks
  
  r47092 at loki (orig r14474):  sartak | 2008-07-24 10:56:32 +0100
   r65011 at onn:  sartak | 2008-07-24 05:56:17 -0400
   Renumber some tests, no reason to have create run before deps
  
  r47093 at loki (orig r14475):  sartak | 2008-07-24 11:01:53 +0100
   r65013 at onn:  sartak | 2008-07-24 06:01:25 -0400
   Properly skip_all in t/sd-rt-hm instead of dying
  
  r47094 at loki (orig r14476):  sartak | 2008-07-24 11:02:02 +0100
   r65014 at onn:  sartak | 2008-07-24 06:01:46 -0400
   Fool the dep test for Jifty because we skip_all if there's no $JIFTY_APP_ROOT
  
  r47110 at loki (orig r14479):  sartak | 2008-07-24 16:30:22 +0100
   r65025 at onn:  sartak | 2008-07-24 11:30:07 -0400
   Eek! Don't set on get..
   This isn't really necessary anymore anyway - the one database we have has creation dates now
  
  r47111 at loki (orig r14480):  sartak | 2008-07-24 16:33:58 +0100
   r65029 at onn:  sartak | 2008-07-24 11:33:49 -0400
   Bump up T:B:L so failures are reported from the right stack level
  
 


Modified: sd/trunk/lib/App/SD/CLI/Command/Pull.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Pull.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Pull.pm	Tue Aug 12 09:13:04 2008
@@ -10,6 +10,7 @@
     local $ENV{PROPHET_RESOLVER} = 'Prompt';
 
     $self->set_arg(to => $self->cli->app_handle->default_replica_type.":file://".$self->cli->app_handle->handle->fs_root);
+    $self->set_arg(db_uuid => $self->app_handle->handle->db_uuid);
 
     super();
 };

Modified: sd/trunk/lib/App/SD/CLI/Command/Push.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Push.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Push.pm	Tue Aug 12 09:13:04 2008
@@ -10,6 +10,7 @@
     local $ENV{PROPHET_RESOLVER} = 'Prompt';
 
     $self->set_arg(from => $self->app_handle->default_replica_type.":file://".$self->app_handle->handle->fs_root);
+    $self->set_arg(db_uuid => $self->app_handle->handle->db_uuid);
 
     super();
 };

Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm	Tue Aug 12 09:13:04 2008
@@ -14,7 +14,7 @@
 
     for my $entry (sort { $a->prop('date') cmp $b->prop('date') } @{$record->comments}) {
          print "id: ".$entry->luid." (".$entry->uuid.")\n";
-        print "date: ".$entry->prop('date')."\n";
+        print "created: ".$entry->prop('created')."\n";
         print $entry->prop('content')."\n";
     }
 

Modified: sd/trunk/lib/App/SD/Model/Ticket.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Ticket.pm	(original)
+++ sd/trunk/lib/App/SD/Model/Ticket.pm	Tue Aug 12 09:13:04 2008
@@ -68,7 +68,7 @@
 }
 
 sub props_to_show {
-    ('id', 'summary', 'status', 'owner', 'date', 'due', 'creator', 'reported_by', 'CF-Broken in', 'CF-Severity')
+    ('id', 'summary', 'status', 'owner', 'created', 'due', 'creator', 'reported_by', 'CF-Broken in', 'CF-Severity')
 }
 
 # this expects ISO dates. we should improve it in the future to require

Modified: sd/trunk/lib/App/SD/Record.pm
==============================================================================
--- sd/trunk/lib/App/SD/Record.pm	(original)
+++ sd/trunk/lib/App/SD/Record.pm	Tue Aug 12 09:13:04 2008
@@ -7,17 +7,26 @@
 use DateTime;
 
 
-sub declared_props { 'date', inner() }
+sub declared_props { 'created', inner() }
 
 extends 'Prophet::Record';
 
-sub canonicalize_prop_date {
+sub canonicalize_prop_created {
     my $self = shift;
     my %args = validate(@_, { props => 1, errors => 1});
-    my $props = shift;
-    if (!$args{props}->{date} ) {
+
+    # has the record been created yet? if so, we don't want to try to
+    # get its properties
+    my $props = $self->uuid ? $self->get_props : {};
+
+    my $created = $args{props}->{created}
+               || $args{props}->{date}
+               || $props->{created}
+               || $props->{date};
+
+    if (!$created ) {
         my $date = DateTime->now;
-        $args{props}->{date} = $date->ymd." ".$date->hms;
+        $args{props}->{created} = $date->ymd." ".$date->hms;
     }
     return 1;
 }

Modified: sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
==============================================================================

Modified: sd/trunk/lib/App/SD/Test.pm
==============================================================================
--- sd/trunk/lib/App/SD/Test.pm	(original)
+++ sd/trunk/lib/App/SD/Test.pm	Tue Aug 12 09:13:04 2008
@@ -12,6 +12,7 @@
 sub create_ticket_ok {
     my @args = (@_);
     my ( $uuid, $luid );
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
     Prophet::Test::run_output_matches( 'sd', [ 'ticket', 'create', '--', @args ],
         [qr/Created ticket (.*?)(?{ $luid = $1})\s+\((.*)(?{ $uuid = $2 })\)/]
     );

Modified: sd/trunk/t/01-create.t
==============================================================================
--- sd/trunk/t/01-create.t	(original)
+++ sd/trunk/t/01-create.t	Tue Aug 12 09:13:04 2008
@@ -13,7 +13,7 @@
 BEGIN {
     require File::Temp;
     $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
-    diag "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
+    warn "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
 }
 # create from sd and push
 my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA');
@@ -24,13 +24,13 @@
    
 );
 
-run_output_matches( 'sd', [ 'ticket', 'show', '--batch', '--id', $yatta_id ],
+run_output_matches( 'sd', [ 'ticket',  
+    'show', '--id', $yatta_id ],
     [
-        "id: $yatta_id ($yatta_uuid)",
-        'summary: YATTA',
-        'status: new',
-        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
-        qr/^creator: .+ at .+$/,
+        qr/id:\s+$yatta_id\s+\($yatta_uuid\)/,
+        qr/summary:\s+YATTA/,
+        qr/status:.+new/,
+        qr/created:\s+\d{4}-\d{2}-\d{2}.+/,
     ]
 );
 

Modified: sd/trunk/t/sd-attachments.t
==============================================================================
--- sd/trunk/t/sd-attachments.t	(original)
+++ sd/trunk/t/sd-attachments.t	Tue Aug 12 09:13:04 2008
@@ -30,9 +30,8 @@
     [ qw/ticket attachment show --batch --id/, $attachment_id ],
     [ 
         qr/id: $attachment_id \($attachment_uuid\)/, 
-        "content: stub",
+        qr/created:\s+\d{4}-\d{2}-\d{2}.+/,
         "content_type: text/plain",
-        qr/date:\s+\d{4}-\d{2}-\d{2}.+/,
         qr/paper_order.doc/,
         "ticket: $yatta_uuid",
     ],
@@ -54,9 +53,8 @@
     [ qw/ticket attachment show --batch --uuid/, $attachment_uuid ],
     [  
         qr/id: (\d+) \($attachment_uuid\)/, 
-        "content: stub",
+        qr/created:\s+\d{4}-\d{2}-\d{2}.+/,
         "content_type: text/plain",
-        qr/date:\s+\d{4}-\d{2}-\d{2}.+/,
         qr/plague_recipe.doc/,
         "ticket: $yatta_uuid"
     ],

Modified: sd/trunk/t/sd-comments.t
==============================================================================
--- sd/trunk/t/sd-comments.t	(original)
+++ sd/trunk/t/sd-comments.t	Tue Aug 12 09:13:04 2008
@@ -34,6 +34,7 @@
     'sd',
     [ qw/ticket comment show --batch --uuid/, $comment_uuid ],
     [   qr/id: (\d+) \($comment_uuid\)/,
+        qr/created: /i,
         qr/This is a test/,
         qr/created: /,
         qr/creator: /,
@@ -56,11 +57,8 @@
     'sd',
     [ qw/ticket comment show --batch --uuid/, $comment_uuid ],
     [ qr/id: (\d+) \($comment_uuid\)/, 
-        qr/I hate you/,
         qr/created: /i,
-        qr/creator: /i,
-        "ticket: $yatta_uuid"
-    ],
+    qr/I hate you/, "ticket: $yatta_uuid" ],
     [],
     "Found the comment new version"
 );

Modified: sd/trunk/t/sd-hm.t
==============================================================================
--- sd/trunk/t/sd-hm.t	(original)
+++ sd/trunk/t/sd-hm.t	Tue Aug 12 09:13:04 2008
@@ -9,7 +9,7 @@
         plan tests => 10;
         require File::Temp;
         $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
-        diag $ENV{'PROPHET_REPO'};
+        warn $ENV{'PROPHET_REPO'};
         eval "use Jifty";
         push @INC, File::Spec->catdir( Jifty::Util->app_root, "lib" );
     } else {



More information about the Bps-public-commit mailing list