[Bps-public-commit] r15066 - in sd/trunk: . bin lib/App/SD lib/App/SD/CLI lib/App/SD/CLI/Command lib/App/SD/CLI/Command/Attachment lib/App/SD/CLI/Command/Ticket lib/App/SD/CLI/Command/Ticket/Attachment lib/App/SD/CLI/Command/Ticket/Comment lib/App/SD/Model lib/App/SD/Replica/Hiveminder lib/App/SD/Replica/RT t
spang at bestpractical.com
spang at bestpractical.com
Tue Aug 12 09:12:21 EDT 2008
Author: spang
Date: Tue Aug 12 09:12:13 2008
New Revision: 15066
Modified:
sd/trunk/ (props changed)
sd/trunk/Makefile.PL
sd/trunk/bin/sd
sd/trunk/lib/App/SD/CLI/Command.pm
sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm
sd/trunk/lib/App/SD/CLI/Command/Help.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Details.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm
sd/trunk/lib/App/SD/Model/Attachment.pm
sd/trunk/lib/App/SD/Model/Comment.pm
sd/trunk/lib/App/SD/Model/Ticket.pm
sd/trunk/lib/App/SD/Record.pm
sd/trunk/lib/App/SD/Replica/Hiveminder.pm
sd/trunk/lib/App/SD/Replica/Hiveminder/PullEncoder.pm
sd/trunk/lib/App/SD/Replica/Hiveminder/PushEncoder.pm
sd/trunk/lib/App/SD/Replica/RT.pm
sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
sd/trunk/lib/App/SD/Test.pm
sd/trunk/t/00-create.t
sd/trunk/t/sd-attachments.t
sd/trunk/t/sd-comments.t
sd/trunk/t/sd-rt-hm.t
Log:
r47041 at loki: spang | 2008-07-23 15:56:22 +0100
r44062 at loki (orig r14080): sartak | 2008-07-14 18:42:45 +0100
r64222 at onn: sartak | 2008-07-14 13:42:31 -0400
Set props instead of setting args, some args-handling cleanup
r44063 at loki (orig r14081): sartak | 2008-07-14 19:05:14 +0100
r64224 at onn: sartak | 2008-07-14 14:04:45 -0400
"name" is a property not an argument
r44064 at loki (orig r14082): sartak | 2008-07-14 19:06:01 +0100
r64225 at onn: sartak | 2008-07-14 14:04:53 -0400
Some test fixes
r44065 at loki (orig r14083): sartak | 2008-07-14 19:47:48 +0100
r64228 at onn: sartak | 2008-07-14 14:47:41 -0400
Test fixes, we're now back to all passing
r44084 at loki (orig r14091): sartak | 2008-07-14 22:33:16 +0100
r64240 at onn: sartak | 2008-07-14 17:33:11 -0400
Don't do the around new thing, do BUILD instead
r44087 at loki (orig r14094): sartak | 2008-07-14 23:02:58 +0100
r64281 at onn: sartak | 2008-07-14 18:02:53 -0400
Give a hint on how to pull from RT
r44089 at loki (orig r14096): sartak | 2008-07-14 23:08:36 +0100
r64286 at onn: sartak | 2008-07-14 18:08:32 -0400
Better error when we can't parse a hiveminder replica spec
r44090 at loki (orig r14097): sartak | 2008-07-14 23:21:28 +0100
r64288 at onn: sartak | 2008-07-14 18:21:12 -0400
Add an _origin_display prop for tickets pulled from an RT
r44095 at loki (orig r14102): sartak | 2008-07-15 00:01:26 +0100
r64290 at onn: sartak | 2008-07-14 19:01:21 -0400
Use the email_of method in Net::Jifty which does the exact same thing
r44115 at loki (orig r14122): sartak | 2008-07-15 18:30:26 +0100
r64320 at onn: sartak | 2008-07-15 13:30:21 -0400
Add _origin_display to tickets from Hiveminder
r44175 at loki (orig r14127): sartak | 2008-07-15 21:24:09 +0100
r64322 at onn: sartak | 2008-07-15 16:23:58 -0400
Default comment creation to pop up an editor instead of asking on stdin
r44178 at loki (orig r14130): sartak | 2008-07-15 22:31:14 +0100
r64328 at onn: sartak | 2008-07-15 17:31:09 -0400
Add a "ticket comment" command which just does "ticket comment create"
r44182 at loki (orig r14134): sartak | 2008-07-16 01:27:30 +0100
r64332 at onn: sartak | 2008-07-15 20:20:39 -0400
Make sure we have a record locator before adding the prop change for it
r44183 at loki (orig r14135): sartak | 2008-07-16 01:30:44 +0100
r64333 at onn: sartak | 2008-07-15 20:20:49 -0400
Explode more gracefully on unknown change types
r44184 at loki (orig r14136): sartak | 2008-07-16 02:12:37 +0100
r64339 at onn: sartak | 2008-07-15 21:12:28 -0400
Some warnings cleanup
r44187 at loki (orig r14139): sartak | 2008-07-16 03:40:28 +0100
r64345 at onn: sartak | 2008-07-15 22:40:14 -0400
Error message fixes
r44188 at loki (orig r14140): sartak | 2008-07-16 05:04:44 +0100
r64347 at onn: sartak | 2008-07-15 23:29:06 -0400
Add an "_origin" property to tickets pulled in from foreign replicas
r44189 at loki (orig r14141): sartak | 2008-07-16 05:05:29 +0100
r64348 at onn: sartak | 2008-07-15 23:55:42 -0400
Don't spew YAML at the user, just let them know there's an update consistency problem
r44190 at loki (orig r14142): sartak | 2008-07-16 05:05:52 +0100
r64349 at onn: sartak | 2008-07-15 23:57:40 -0400
Canonicalize Due dates from RT to ISO
r44191 at loki (orig r14143): sartak | 2008-07-16 05:06:03 +0100
r64350 at onn: sartak | 2008-07-16 00:04:28 -0400
Color overdue tickets' due dates red
r44192 at loki (orig r14144): sartak | 2008-07-16 05:41:14 +0100
r64355 at onn: sartak | 2008-07-16 00:41:03 -0400
Strip subsequent lines in "die" unless $ENV{SD_VERBOSE_ERROR} is set, because no one but SD hackers will really want the stack trace
r44193 at loki (orig r14145): sartak | 2008-07-16 05:44:29 +0100
r64357 at onn: sartak | 2008-07-16 00:44:23 -0400
Remove _origin, we can figure it out in other ways
r44271 at loki (orig r14176): sartak | 2008-07-16 23:55:29 +0100
r64454 at onn: sartak | 2008-07-16 18:55:17 -0400
Use the --force argument to allow multi-db merge
r45828 at loki (orig r14248): jesse | 2008-07-18 04:03:38 +0100
* tiny tweaks as I start messing with formatting
r45830 at loki (orig r14250): sartak | 2008-07-18 04:31:54 +0100
r64549 at onn: sartak | 2008-07-17 23:31:47 -0400
Add a ticket resolve command
r45834 at loki (orig r14254): sartak | 2008-07-18 05:09:09 +0100
r64555 at onn: sartak | 2008-07-18 00:06:50 -0400
Make the default status "new"
r45861 at loki (orig r14281): jesse | 2008-07-18 20:23:04 +0100
* smarted up sd's error truncator to not truncate intentional two-line errors
r45874 at loki (orig r14294): sartak | 2008-07-18 23:06:50 +0100
r64606 at onn: sartak | 2008-07-18 18:06:36 -0400
Some fixes for the new update output. but sd-validation is still failing for me
r45876 at loki (orig r14296): jesse | 2008-07-19 00:11:41 +0100
* Tests pass! ship it!
(Mostly new formats in this commit)
r45904 at loki (orig r14324): jesse | 2008-07-20 23:54:35 +0100
* cleanups for the record_type -> type refactor
r46919 at loki (orig r14409): jesse | 2008-07-23 03:53:03 +0100
* cut down the dependencies in the makefile.pl
r46937 at loki (orig r14427): cwest | 2008-07-23 09:28:24 +0100
38F74B4E-5890-11DD-B29A-74F03D9AEBE7: prop(date) for all App::SD::Record types
Modified: sd/trunk/Makefile.PL
==============================================================================
Modified: sd/trunk/bin/sd
==============================================================================
--- sd/trunk/bin/sd (original)
+++ sd/trunk/bin/sd Tue Aug 12 09:12:13 2008
@@ -6,6 +6,19 @@
$ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} || $ENV{'HOME'}.'/.sd';
+# Moose likes generating very noisy backtraces. Most users don't need to see
+# anything more than the root cause of the failure. Developers and the curious
+# can set environment variable SD_VERBOSE_ERROR to retain the backtraces.
+# When Moose's error throwing is more malleable we should switch to using that.
+unless ($ENV{SD_VERBOSE_ERROR} || $ENV{'TEST_VERBOSE'}) {
+ $SIG{__DIE__} = sub {
+ my $line = shift;
+ $line =~ s/\n.*//s if ($line =~ /at line/s);
+ $line .= "\n"; $line =~ s/\n+$/\n/gs;
+ die $line;
+ };
+}
+
my $cli = Prophet::CLI->new({ app_class => 'App::SD' });
$cli->run_one_command;
Modified: sd/trunk/lib/App/SD/CLI/Command.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command.pm Tue Aug 12 09:12:13 2008
@@ -4,18 +4,18 @@
sub get_content {
my $self = shift;
- my $type = shift;
+ my %args = @_;
my $content;
- if (my $file = file(delete $self->args->{'file'})) {
+ if (my $file = file($self->delete_arg('file'))) {
$content = $file->slurp();
- $self->args->{'name'} = $file->basename;
- } elsif ($content = delete $self->args->{'content'}) {
+ $self->set_prop(name => $file->basename);
+ } elsif ($content = $self->delete_arg('content')) {
- } elsif (exists $self->args->{'edit'}) {
+ } elsif ($args{default_edit} || $self->has_arg('edit')) {
$content = $self->edit_text('');
} else {
- print "Please type your $type and press ctrl-d.\n";
+ print "Please type your $args{type} and press ctrl-d.\n";
$content = do { local $/; <> };
}
Modified: sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm Tue Aug 12 09:12:13 2008
@@ -6,7 +6,7 @@
before run => sub {
my $self = shift;
- $self->args->{'content'} = $self->get_content('attachment');
+ $self->set_prop(content => $self->get_content(type => 'attachment'));
};
__PACKAGE__->meta->make_immutable;
Modified: sd/trunk/lib/App/SD/CLI/Command/Help.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Help.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Help.pm Tue Aug 12 09:12:13 2008
@@ -9,7 +9,8 @@
$0 @{[$App::SD::VERSION]}
$0 ticket create --summary "This is a summary" --status new --somekey value
-$0 ticket update --uuid <uuid> --status resolved
+$0 ticket update --uuid <uuid> --status closed
+$0 ticket resolve --uuid <uuid>
$0 ticket search --regex .
$0 ticket delete --uuid <uuid>
$0 ticket show --uuid <uuid>
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm Tue Aug 12 09:12:13 2008
@@ -5,7 +5,7 @@
before run => sub {
my $self = shift;
- $self->args->{'ticket'} = $self->cli->uuid;
+ $self->set_prop(ticket => $self->cli->uuid);
};
__PACKAGE__->meta->make_immutable;
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment.pm Tue Aug 12 09:12:13 2008
@@ -2,8 +2,6 @@
use Moose;
extends 'App::SD::CLI::Command::Ticket::Comment::Create';
-sub type { 'comment' }
-
__PACKAGE__->meta->make_immutable;
no Moose;
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm Tue Aug 12 09:12:13 2008
@@ -8,8 +8,8 @@
# override args to feed in that ticket's uuid as an argument to the comment
before run => sub {
my $self = shift;
- $self->args->{'ticket'} = $self->cli->uuid;
- $self->args->{'content'} = $self->get_content('comment');
+ $self->set_prop(ticket => $self->cli->uuid);
+ $self->set_prop(content => $self->get_content(type => 'comment', default_edit => 1));
};
__PACKAGE__->meta->make_immutable;
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:12:13 2008
@@ -12,10 +12,10 @@
print "No comments found\n";
}
- for (sort { $a->prop('date') cmp $b->prop('date') } @{$record->comments}) {
- print "id: ".$_->luid." (".$_->uuid.")\n";
- print "date: ".$_->prop('date')."\n";
- print $_->prop('content')."\n";
+ 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 $entry->prop('content')."\n";
}
}
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Details.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Details.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Details.pm Tue Aug 12 09:12:13 2008
@@ -12,6 +12,7 @@
print "\n=head1 ATTACHMENTS\n\n";
my $attachments = App::SD::Collection::Attachment->new(
handle => $self->app_handle->handle,
+ app_handle => $self->app_handle,
);
$attachments->matching(sub {
shift->prop('ticket') eq $self->uuid ? 1 : 0;
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm Tue Aug 12 09:12:13 2008
@@ -6,5 +6,6 @@
__PACKAGE__->meta->make_immutable;
no Moose;
+
1;
Modified: sd/trunk/lib/App/SD/Model/Attachment.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Attachment.pm (original)
+++ sd/trunk/lib/App/SD/Model/Attachment.pm Tue Aug 12 09:12:13 2008
@@ -9,8 +9,6 @@
use constant collection_class => 'App::SD::Collection::Attachment';
use constant type => 'attachment';
-use constant summary_format => '%l %s %s';
-use constant summary_props => qw(name content_type);
sub _default_summary_format { '%s,$luid | %s,name | %s,content_type'}
Modified: sd/trunk/lib/App/SD/Model/Comment.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Comment.pm (original)
+++ sd/trunk/lib/App/SD/Model/Comment.pm Tue Aug 12 09:12:13 2008
@@ -18,6 +18,4 @@
__PACKAGE__->register_reference( ticket => 'App::SD::Model::Comment');
-__PACKAGE__->meta->make_immutable;
-no Moose;
1;
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:12:13 2008
@@ -7,9 +7,9 @@
use constant collection_class => 'App::SD::Collection::Ticket';
use constant type => 'ticket';
-=head2 default_prop_status
+sub default_prop_status { 'new' }
-Returns a string of the default value of the status prop.
+sub _default_summary_format { '%s,$luid | %s,summary | %s,status' }
=cut
@@ -60,8 +60,43 @@
return colored($value, $color);
}
+sub color_prop_due {
+ my ($self, $due) = @_;
+
+ return colored($due, 'red') if $self->is_overdue($due);
+ return $due;
+}
+
sub props_to_show {
- ('id', 'summary', 'status', 'owner', 'due', 'creator', 'reported_by', 'CF-Broken in', 'CF-Severity')
+ ('id', 'summary', 'status', 'owner', 'date', 'due', 'creator', 'reported_by', 'CF-Broken in', 'CF-Severity')
+}
+
+# this expects ISO dates. we should improve it in the future to require
+sub is_overdue {
+ my $self = shift;
+ my $date = shift || $self->prop('due');
+
+ return 0 if !$date;
+
+ if ($date !~ /^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/) {
+ warn "Unknown date format '$date'";
+ return 0;
+ }
+
+ my $dt = eval { DateTime->new(
+ year => $1,
+ month => $2,
+ day => $3,
+ hour => $4,
+ minute => $5,
+ second => $6,
+ time_zone => 'UTC',
+ ) };
+ warn $@ if $@;
+ return 0 if !$dt;
+
+ my $now = DateTime->now(time_zone => 'UTC');
+ return $now > $dt;
}
__PACKAGE__->register_reference( comments => 'App::SD::Collection::Comment', by => 'ticket');
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:12:13 2008
@@ -4,41 +4,24 @@
package App::SD::Record; # should probably be Prophet::App::Record
use Moose;
use Params::Validate;
+use DateTime;
-sub declared_props { 'created', inner() }
+sub declared_props { 'date', inner() }
extends 'Prophet::Record';
-sub canonicalize_prop_created {
+sub canonicalize_prop_date {
my $self = shift;
my %args = validate(@_, { props => 1, errors => 1});
-
- # 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 @now = gmtime();
-
- $args{props}->{created} = sprintf(
- "%04d-%02d-%02d %02d:%02d:%02d",
- ( $now[5] + 1900 ),
- ( $now[4] + 1 ),
- $now[3], $now[2], $now[1], $now[0]
- );
-
+ my $props = shift;
+ if (!$args{props}->{date} ) {
+ my $date = DateTime->now;
+ $args{props}->{date} = $date->ymd." ".$date->hms;
}
return 1;
}
-__PACKAGE__->meta->make_immutable;
-no Moose;
1;
Modified: sd/trunk/lib/App/SD/Replica/Hiveminder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/Hiveminder.pm (original)
+++ sd/trunk/lib/App/SD/Replica/Hiveminder.pm Tue Aug 12 09:12:13 2008
@@ -15,17 +15,6 @@
use constant scheme => 'hm';
-# XXX: this should be called from superclass, or better, have individual attributes have their own builders.
-
-around 'new' => sub {
- my ($next, $self, @args) = @_;
- warn "around $self $next";
- my $ret = $self->$next(@args);
- $ret->setup;
- warn "==> $ret";
- return $ret;
-};
-
=head2 setup
@@ -33,13 +22,14 @@
=cut
+# XXX: this should be called from superclass, or better, have individual attributes have their own builders.
sub BUILD {
my $self = shift;
require Net::Jifty;
my ($server) = $self->{url} =~ m/^hm:(.*?)$/
- or die "Can't parse hiveminder server spec";
+ or die "Can't parse Hiveminder server spec. Expected hm:http://hiveminder.com";
$self->url($server);
my $uri = URI->new($server);
my ( $username, $password );
Modified: sd/trunk/lib/App/SD/Replica/Hiveminder/PullEncoder.pm
==============================================================================
Modified: sd/trunk/lib/App/SD/Replica/Hiveminder/PushEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/Hiveminder/PushEncoder.pm (original)
+++ sd/trunk/lib/App/SD/Replica/Hiveminder/PushEncoder.pm Tue Aug 12 09:12:13 2008
@@ -83,11 +83,11 @@
}
sub integrate_comment {
- warn "comment not yet";
+ warn "comment not implemented yet";
}
sub integrate_ticket_update {
- warn "update not yet";
+ warn "update not implemented yet";
}
sub _recode_props_for_integrate {
Modified: sd/trunk/lib/App/SD/Replica/RT.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/RT.pm (original)
+++ sd/trunk/lib/App/SD/Replica/RT.pm Tue Aug 12 09:12:13 2008
@@ -38,7 +38,7 @@
require RT::Client::REST::Ticket;
my ( $server, $type, $query ) = $self->{url} =~ m/^rt:(.*?)\|(.*?)\|(.*)$/
- or die "Can't parse rt server spec";
+ or die "Can't parse RT server spec. Expected rt:http://example.com|QUEUE|QUERY. Try: rt:http://example.com/|General|";
my $uri = URI->new($server);
my ( $username, $password );
if ( my $auth = $uri->userinfo ) {
@@ -48,7 +48,6 @@
$self->rt_url($uri->as_string);
$self->rt_queue($type);
$self->rt_query( ( $query ? "($query) AND " :"") . " Queue = '$type'" );
- warn $self->rt_query;
$self->rt( RT::Client::REST->new( server => $server ) );
( $username, $password ) = $self->prompt_for_login( $uri, $username )
Modified: sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm (original)
+++ sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm Tue Aug 12 09:12:13 2008
@@ -61,11 +61,12 @@
my $ticket = shift;
$ticket->{'id'} =~ s/^ticket\///g;
+
map { $ticket->{ $self->sync_source->uuid . '-' . lc($_) } = delete $ticket->{$_} }
(qw(Queue id));
map { delete $ticket->{$_} if ( !defined $ticket->{$_} || $ticket->{$_} eq '' ) } keys %$ticket;
map { $ticket->{$_} = $self->date_to_iso( $ticket->{$_} ) }
- qw(Created Resolved Told LastUpdated Starts Started);
+ qw(Created Resolved Told LastUpdated Due Starts Started);
map { $ticket->{$_} =~ s/ minutes$// if defined $ticket->{$_} }
qw(TimeWorked TimeLeft TimeEstimated);
$ticket->{'Status'} =~ s/^(resolved|rejected)$/closed/;
@@ -237,7 +238,7 @@
$args{'ticket'}->{ $args{txn}->{Field} } = $args{txn}->{'OldValue'};
} else {
$args{'ticket'}->{ $args{txn}->{Field} } = $args{txn}->{'OldValue'};
- warn $args{'ticket'}->{ $args{txn}->{Field} } . " != " . $args{txn}->{'NewValue'} . "\n\n" . YAML::Dump( \%args ); use YAML;
+ warn "Update consistency problem: " . $args{'ticket'}->{ $args{txn}->{Field} } . " != " . $args{txn}->{'NewValue'};
}
$change->add_prop_change(
name => $args{txn}->{'Field'},
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:12:13 2008
@@ -12,7 +12,6 @@
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/00-create.t
==============================================================================
--- sd/trunk/t/00-create.t (original)
+++ sd/trunk/t/00-create.t Tue Aug 12 09:12:13 2008
@@ -2,7 +2,7 @@
use strict;
-use Prophet::Test tests => 2;
+use Prophet::Test tests => 3;
use App::SD::Test;
use File::Temp qw/tempdir/;
use Path::Class;
@@ -16,7 +16,7 @@
warn "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
}
# create from sd and push
-my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
+my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA');
run_output_matches( 'sd', [ 'ticket',
'list', '--regex', '.' ],
@@ -24,3 +24,13 @@
);
+run_output_matches( 'sd', [ 'ticket',
+ 'show', '--id', $yatta_id ],
+ [
+ qr/id:\s+$yatta_id\s+\($yatta_uuid\)/,
+ qr/summary:\s+YATTA/,
+ qr/status:.+new/,
+ qr/date:\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:12:13 2008
@@ -21,7 +21,7 @@
my $attachment_id;
my $attachment_uuid;
-run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--content', 'stub', '--name', "paper_order.doc"], [qr/Created attachment (\d+)(?{ $attachment_id = $1}) \((.*)(?{ $attachment_uuid = $2})\)/], [], "Added a attachment");
+run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--content', 'stub', '--', '--name', "paper_order.doc"], [qr/Created attachment (\d+)(?{ $attachment_id = $1}) \((.*)(?{ $attachment_uuid = $2})\)/], [], "Added a attachment");
ok($attachment_id, " $attachment_id = $attachment_uuid");
run_output_matches('sd', [qw/ticket attachment list --uuid/, $yatta_uuid], [qr/\d+ paper_order.doc text\/plain/,], [], "Found the attachment");
@@ -32,8 +32,7 @@
qr/id: $attachment_id \($attachment_uuid\)/,
"content: stub",
"content_type: text/plain",
- qr/created: \d{4}-\d{2}-\d{2}.+/,
- qr/creator: .+ at .+$/,
+ qr/date:\s+\d{4}-\d{2}-\d{2}.+/,
qr/paper_order.doc/,
"ticket: $yatta_uuid",
],
@@ -43,6 +42,7 @@
run_output_matches(
'sd',
[ qw/ticket attachment update --uuid/, $attachment_uuid,
+ '--',
qw/--name/, "plague_recipe.doc"
],
[qr/attachment \d+ \($attachment_uuid\) updated/],
@@ -56,8 +56,7 @@
qr/id: (\d+) \($attachment_uuid\)/,
"content: stub",
"content_type: text/plain",
- qr/created: \d{4}-\d{2}-\d{2}.+/,
- qr/creator: .+ at .+$/,
+ qr/date:\s+\d{4}-\d{2}-\d{2}.+/,
qr/plague_recipe.doc/,
"ticket: $yatta_uuid"
],
Modified: sd/trunk/t/sd-comments.t
==============================================================================
Modified: sd/trunk/t/sd-rt-hm.t
==============================================================================
More information about the Bps-public-commit
mailing list