[Bps-public-commit] r15629 - in sd/trunk: . lib/App/SD/CLI/Command lib/App/SD/Replica/rt t
jesse at bestpractical.com
jesse at bestpractical.com
Thu Aug 28 21:43:35 EDT 2008
Author: jesse
Date: Thu Aug 28 21:43:35 2008
New Revision: 15629
Added:
sd/trunk/lib/App/SD/CLI/Command/Pull.pm
sd/trunk/lib/App/SD/CLI/Command/Push.pm
Removed:
sd/trunk/t/sd-rt-hm-single.t
Modified:
sd/trunk/ (props changed)
sd/trunk/Makefile.PL
sd/trunk/lib/App/SD/CLI/Command/Log.pm
sd/trunk/lib/App/SD/Model/Comment.pm
sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm
Log:
r44655 at 31b (orig r15576): jesse | 2008-08-27 18:24:27 -0700
r44633 at 192: jesse | 2008-08-27 16:23:22 -0700
* Use Time::Progress to report how we're doing at walking RT ticket history
r44656 at 31b (orig r15577): jesse | 2008-08-27 18:24:39 -0700
r44636 at 192: jesse | 2008-08-27 16:41:09 -0700
* A comment's ticket refers to a ticket, not to a comment
r44657 at 31b (orig r15578): jesse | 2008-08-27 18:24:59 -0700
r44637 at 192: jesse | 2008-08-27 16:41:30 -0700
* slightly better display of comments in ticket history
Modified: sd/trunk/Makefile.PL
==============================================================================
--- sd/trunk/Makefile.PL (original)
+++ sd/trunk/Makefile.PL Thu Aug 28 21:43:35 2008
@@ -4,7 +4,7 @@
copyright('2008 Best Practical Solutions, LLC');
license('MIT');
version_from('lib/App/SD.pm');
-
+requires('Time::Progress');
requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
requires('Moose'); # Moose::Role
requires('HTTP::Date');
Modified: sd/trunk/lib/App/SD/CLI/Command/Log.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Log.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Log.pm Thu Aug 28 21:43:35 2008
@@ -6,6 +6,7 @@
my $self = shift;
my $changeset = shift;
print $changeset->as_string(
+ skip_empty => 1,
change_filter => sub {
my $change = shift;
return undef if $change->record_type eq '_merge_tickets';
@@ -17,10 +18,10 @@
},
header_callback => sub {
my $c = shift;
- sprintf "Change %d by %s at %s\n",
- $c->sequence_no,
- ( $c->creator || '(unknown)' ),
+ sprintf "%s - %s @ %s\n",
$c->created,
+ ( $c->creator || '(unknown)' ),
+ $c->original_source_uuid
;
}
@@ -48,6 +49,22 @@
}
}
+
+sub change_header_comment {
+ my $self = shift;
+ my $change = shift;
+ require App::SD::Model::Comment;
+ my $c = App::SD::Model::Comment->new( handle => $self->handle, type => App::SD::Model::Comment->type);
+ $c->load(uuid => $change->record_uuid);
+ warn "getting ticket";
+ if ($c->prop('ticket')) {
+ my $t = $c->ticket;
+ return " # Comment on ticket " . $t->luid . " (".$t->prop('summary').")"
+ } else {
+ return "# Comment on unknown ticket";
+ }
+}
+
sub change_header_ticket {
my $self = shift;
my $change = shift;
Added: sd/trunk/lib/App/SD/CLI/Command/Pull.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Pull.pm Thu Aug 28 21:43:35 2008
@@ -0,0 +1,9 @@
+package App::SD::CLI::Command::Pull;
+use Moose;
+extends qw/Prophet::CLI::Command::Pull/;
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Push.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Push.pm Thu Aug 28 21:43:35 2008
@@ -0,0 +1,9 @@
+package App::SD::CLI::Command::Push;
+use Moose;
+extends qw/Prophet::CLI::Command::Push/;
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
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 Thu Aug 28 21:43:35 2008
@@ -16,7 +16,7 @@
#has SVK::Model::Ticket;
-__PACKAGE__->register_reference( ticket => 'App::SD::Model::Comment');
+__PACKAGE__->register_reference( ticket => 'App::SD::Model::Ticket');
__PACKAGE__->meta->make_immutable;
no Moose;
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 Thu Aug 28 21:43:35 2008
@@ -4,6 +4,7 @@
use Params::Validate qw(:all);
use Memoize;
+use Time::Progress;
has sync_source =>
( isa => 'App::SD::Replica::rt',
@@ -29,9 +30,16 @@
$self->sync_source->log("No tickets found.") if @tickets == 0;
my $counter = 0;
- for my $id ( @tickets) {
+ $self->sync_source->log("Discovering ticket history");
+ my $progress = Time::Progress->new();
+ $progress->attr( max => $#tickets );
+ local $| = 1;
+ for my $id (@tickets) {
$counter++;
- $self->sync_source->log("Fetching ticket $id - $counter of ".scalar @tickets);
+ print $progress->report( "%30b %p Est: %E\r", $counter );
+
+ $self->sync_source->log(
+ "Fetching ticket $id - $counter of " . scalar @tickets );
$tickets->{$id}->{ticket} = $self->_translate_final_ticket_state(
$self->sync_source->rt->show( type => 'ticket', id => $id )
);
More information about the Bps-public-commit
mailing list