[Bps-public-commit] r16767 - in sd/trunk: . lib/App lib/App/SD lib/App/SD/CLI lib/App/SD/CLI/Command/Ticket t
sartak at bestpractical.com
sartak at bestpractical.com
Sat Nov 8 03:40:58 EST 2008
Author: sartak
Date: Sat Nov 8 03:40:58 2008
New Revision: 16767
Removed:
sd/trunk/t/prophet_testing.conf
Modified:
sd/trunk/ (props changed)
sd/trunk/lib/App/SD.pm
sd/trunk/lib/App/SD/CLI/Command.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm
sd/trunk/lib/App/SD/Replica/hm.pm
sd/trunk/lib/App/SD/Replica/rt.pm
sd/trunk/lib/App/SD/Test.pm
sd/trunk/t/01-create.t
sd/trunk/t/02-create-with-editor.t
sd/trunk/t/03-update-ticket-with-editor.t
sd/trunk/t/04-update-ticket-comment-with-editor.t
sd/trunk/t/05-config-file-loading.t
sd/trunk/t/attachment-content.t
sd/trunk/t/sd-attachments.t
sd/trunk/t/sd-comments.t
sd/trunk/t/sd-hm-comments.t
sd/trunk/t/sd-hm-comments1.t
sd/trunk/t/sd-hm-group.t
sd/trunk/t/sd-hm-tag.t
sd/trunk/t/sd-hm-update.t
sd/trunk/t/sd-hm.t
sd/trunk/t/sd-rt-hm-single.t
sd/trunk/t/sd-rt-hm.t
sd/trunk/t/sd-rt-n-foreign-sync.t
sd/trunk/t/sd-rt-permission.t
sd/trunk/t/sd-rt.t
sd/trunk/t/sd-validation.t
Log:
Merge down SD's clone-and-init branch
Modified: sd/trunk/lib/App/SD.pm
==============================================================================
--- sd/trunk/lib/App/SD.pm (original)
+++ sd/trunk/lib/App/SD.pm Sat Nov 8 03:40:58 2008
@@ -5,7 +5,7 @@
extends 'Prophet::App';
our $VERSION = '0.01';
-has +config => (
+has '+config' => (
default => sub {
my $self = shift;
return App::SD::Config->new(app_handle => $self);
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 Sat Nov 8 03:40:58 2008
@@ -50,7 +50,8 @@
if (my $footer = $args{footer}) {
$text .= $footer;
}
- $content = $self->edit_text($text);
+
+ $content = $self->edit_text($text);
# user aborted their text editor without changing anything; signify
# this to the caller by returning nothing
$content = '' if $content eq $text;
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm Sat Nov 8 03:40:58 2008
@@ -14,7 +14,7 @@
my $self = shift;
$self->require_uuid;
my $record = $self->_load_record;
- return super() if (@{$self->prop_set} && !$self->has_arg('edit'));
+ return super() if ($self->context->prop_names && !$self->has_arg('edit'));
my $template_to_edit = $self->create_record_template($record);
my $done = 0;
Modified: sd/trunk/lib/App/SD/Replica/hm.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/hm.pm (original)
+++ sd/trunk/lib/App/SD/Replica/hm.pm Sat Nov 8 03:40:58 2008
@@ -27,7 +27,6 @@
sub BUILD {
my $self = shift;
-
require Net::Jifty;
my ($server, $props) = $self->{url} =~ m/^hm:(.*?)(?:\|(.*))?$/
or die "Can't parse Hiveminder server spec. Expected hm:http://hiveminder.com or hm:http://hiveminder.com|props";
@@ -39,13 +38,12 @@
$uri->userinfo(undef);
}
$self->remote_url("$uri");
+ $self->hm_username($username);
( $username, $password ) = $self->prompt_for_login( $uri, $username ) unless $password;
-
if ( $props ) {
my %props = split /=|;/, $props;
$self->props( \%props );
}
-
$self->hm(
Net::Jifty->new(
site => $self->remote_url,
@@ -55,18 +53,17 @@
password => $password
)
);
-
- $self->hm_username($username);
}
=head2 uuid
-Return the replica SVN repository's UUID
+Return the replica's UUID
=cut
sub uuid {
my $self = shift;
+ Carp::cluck "- can't make a uuid for this" unless ($self->remote_url && $self->hm_username);
return $self->uuid_for_url( join( '/', $self->remote_url, $self->hm_username ) );
}
@@ -96,7 +93,13 @@
sub find_matching_tasks {
my $self = shift;
- my %args;
+ my %args = (
+ owner => 'me',
+ group => 0,
+ requestor => 'me',
+ not_complete => 1,
+ );
+
if ( my $props = $self->props ) {
while ( my ($k, $v) = each %$props ) { $args{$k} = $v }
}
@@ -142,6 +145,9 @@
{ isa => 'Prophet::ChangeSet' }
);
+ # don't push internal records
+ return if $change->record_type =~ /^__/;
+
require App::SD::Replica::hm::PushEncoder;
my $recoder = App::SD::Replica::hm::PushEncoder->new( { sync_source => $self } );
$recoder->integrate_change($change,$changeset);
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 Sat Nov 8 03:40:58 2008
@@ -16,16 +16,7 @@
has rt_queue => ( isa => 'Str', is => 'rw');
has rt_query => ( isa => 'Str', is => 'rw');
-# XXX: this should be called from superclass, or better, have individual attributes have their own builders.
-
-around 'new' => sub {
- my ($next, $self, @args) = @_;
- my $ret = $self->$next(@args);
- $ret->setup;
- return $ret;
-};
-
-sub setup {
+sub BUILD {
my $self = shift;
# Require rather than use to defer load
@@ -83,6 +74,9 @@
{ isa => 'Prophet::ChangeSet' }
);
+ # don't push internal records
+ return if $change->record_type =~ /^__/;
+
require App::SD::Replica::rt::PushEncoder;
my $recoder = App::SD::Replica::rt::PushEncoder->new( { sync_source => $self } );
$recoder->integrate_change($change,$changeset);
Modified: sd/trunk/lib/App/SD/Test.pm
==============================================================================
--- sd/trunk/lib/App/SD/Test.pm (original)
+++ sd/trunk/lib/App/SD/Test.pm Sat Nov 8 03:40:58 2008
@@ -11,6 +11,7 @@
our @EXPORT = qw(create_ticket_ok create_ticket_with_editor_ok create_ticket_comment_ok get_uuid_for_luid get_luid_for_uuid);
$ENV{'SD_CONFIG'} = 't/prophet_testing.conf';
delete $ENV{'PROPHET_APP_CONFIG'};
+$ENV{'EDITOR'} = '/bin/true';
=head2 create_ticket_ok ARGS
@@ -101,7 +102,8 @@
my ( $ticket_uuid, $ticket_luid, $comment_uuid, $comment_luid );
local $Test::Builder::Level = $Test::Builder::Level + 1;
Prophet::Test::run_output_matches( 'sd', [ 'ticket', 'create' ],
- [qr/Created ticket (.*?)(?{ $ticket_luid = $1})\s+\((.*)(?{ $ticket_uuid = $2 })\)/, qr/Created comment (.*?)(?{ $comment_luid = $1})\s+\((.*)(?{ $comment_uuid = $2 })\)/]
+ [qr/Created ticket (.*?)(?{ $ticket_luid = $1})\s+\((.*)(?{ $ticket_uuid = $2 })\)/,
+ qr/Created comment (.*?)(?{ $comment_luid = $1})\s+\((.*)(?{ $comment_uuid = $2 })\)/]
);
return ( $ticket_luid, $ticket_uuid, $comment_luid, $comment_uuid );
Modified: sd/trunk/t/01-create.t
==============================================================================
--- sd/trunk/t/01-create.t (original)
+++ sd/trunk/t/01-create.t Sat Nov 8 03:40:58 2008
@@ -16,6 +16,8 @@
diag "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
}
+run_script( 'sd', [ 'init']);
+
# create from sd and push
my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA');
@@ -32,7 +34,7 @@
'status: new',
qr/^created: \d{4}-\d{2}-\d{2}.+$/,
qr/^creator: /,
- qr/^reported_by: /,
+ 'reported_by: ' . $ENV{EMAIL},
'milestone: alpha',
"original_replica: " . replica_uuid,
]
Modified: sd/trunk/t/02-create-with-editor.t
==============================================================================
--- sd/trunk/t/02-create-with-editor.t (original)
+++ sd/trunk/t/02-create-with-editor.t Sat Nov 8 03:40:58 2008
@@ -10,6 +10,7 @@
diag 'export SD_REPO=' . $ENV{'PROPHET_REPO'} . "\n";
App::SD::Test->set_editor('ticket-create-editor.pl');
}
+run_script( 'sd', [ 'init']);
my $replica_uuid = replica_uuid;
my ($ticket_id, $ticket_uuid, $comment_id, $comment_uuid) = create_ticket_with_editor_ok();
@@ -26,7 +27,7 @@
'status: new',
qr/^created: \d{4}-\d{2}-\d{2}.+$/,
qr/^creator: /,
- qr/^reported_by: /,
+ 'reported_by: ' . $ENV{EMAIL},
'milestone: alpha',
"original_replica: $replica_uuid",
]
Modified: sd/trunk/t/03-update-ticket-with-editor.t
==============================================================================
--- sd/trunk/t/03-update-ticket-with-editor.t (original)
+++ sd/trunk/t/03-update-ticket-with-editor.t Sat Nov 8 03:40:58 2008
@@ -10,6 +10,7 @@
diag 'export SD_REPO=' . $ENV{'PROPHET_REPO'} . "\n";
App::SD::Test->set_editor('ticket-update-editor.pl');
}
+run_script( 'sd', [ 'init']);
my $replica_uuid = replica_uuid;
@@ -26,7 +27,7 @@
'owner: foo at bar.com',
qr/^created: \d{4}-\d{2}-\d{2}.+$/,
qr/^creator: /,
- qr/^reported_by: /,
+ 'reported_by: ' . $ENV{EMAIL},
'milestone: alpha',
"original_replica: $replica_uuid",
]
@@ -43,7 +44,7 @@
'status: new',
qr/^created: \d{4}-\d{2}-\d{2}.+$/,
qr/^creator: /,
- qr/^reported_by: /,
+ 'reported_by: ' . $ENV{EMAIL},
'milestone: alpha',
"original_replica: $replica_uuid",
]
Modified: sd/trunk/t/04-update-ticket-comment-with-editor.t
==============================================================================
--- sd/trunk/t/04-update-ticket-comment-with-editor.t (original)
+++ sd/trunk/t/04-update-ticket-comment-with-editor.t Sat Nov 8 03:40:58 2008
@@ -11,6 +11,9 @@
App::SD::Test->set_editor('ticket-comment-update-editor.pl');
}
+run_script( 'sd', [ 'init']);
+
+
my $replica_uuid = replica_uuid;
# create ticket
Modified: sd/trunk/t/05-config-file-loading.t
==============================================================================
--- sd/trunk/t/05-config-file-loading.t (original)
+++ sd/trunk/t/05-config-file-loading.t Sat Nov 8 03:40:58 2008
@@ -15,10 +15,13 @@
$ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = $ENV{'HOME'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
diag "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
diag "export HOME=".$ENV{'PROPHET_REPO'} ."\n";
- $ENV{'PROPHET_APP_CONFIG'} = undef; # clear this because Prophet::Test sets it
+ delete $ENV{'PROPHET_APP_CONFIG'}; # clear this because Prophet::Test sets it
}
# Tests the config file order of preference laid out in App::SD::Config
+run_script( 'sd', [ 'init']);
+
+
# create from sd
my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA');
@@ -31,7 +34,10 @@
[ qr/(\d+) YATTA new/]
);
-$ENV{'SD_CONFIG'} = $ENV{'PROPHET_APP_CONFIG'} = undef; # override App::SD::Test
+# override App::SD::Test
+delete $ENV{'SD_CONFIG'};
+delete $ENV{'PROPHET_APP_CONFIG'};
+
ok( ! $ENV{'SD_CONFIG'}, "SD_CONFIG env var has been cleared" );
ok( ! $ENV{'PROPHET_APP_CONFIG'}, "PROPHET_APP_CONFIG env var has been cleared" );
@@ -106,5 +112,5 @@
run_output_matches( 'sd', [ 'ticket',
'list', '--regex', '.' ],
- [ qr/(\d+) YATTA new/]
+ [ qr/(\d+) } new YATTA /]
);
Modified: sd/trunk/t/attachment-content.t
==============================================================================
--- sd/trunk/t/attachment-content.t (original)
+++ sd/trunk/t/attachment-content.t Sat Nov 8 03:40:58 2008
@@ -22,6 +22,9 @@
$ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
diag "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
}
+run_script( 'sd', [ 'init']);
+
+
# create from sd and push
my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
Modified: sd/trunk/t/sd-attachments.t
==============================================================================
--- sd/trunk/t/sd-attachments.t (original)
+++ sd/trunk/t/sd-attachments.t Sat Nov 8 03:40:58 2008
@@ -12,6 +12,9 @@
diag "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
}
+run_script( 'sd', [ 'init']);
+
+
my $replica_uuid = replica_uuid;
# create from sd and push
my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
Modified: sd/trunk/t/sd-comments.t
==============================================================================
--- sd/trunk/t/sd-comments.t (original)
+++ sd/trunk/t/sd-comments.t Sat Nov 8 03:40:58 2008
@@ -13,6 +13,9 @@
diag $ENV{'PROPHET_REPO'};
}
+run_script( 'sd', [ 'init']);
+
+
my $replica_uuid = replica_uuid;
# create from sd and push
Modified: sd/trunk/t/sd-hm-comments.t
==============================================================================
--- sd/trunk/t/sd-hm-comments.t (original)
+++ sd/trunk/t/sd-hm-comments.t Sat Nov 8 03:40:58 2008
@@ -40,8 +40,13 @@
my ($yatta_uuid, $yatta_id);
{
- my ($ret, $out, $err) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
-
+ diag($sd_hm_url);
+ my ($ret, $out, $err) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] );
+
+ diag($ret);
+ diag($out);
+ diag($err);
+
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;
Modified: sd/trunk/t/sd-hm-comments1.t
==============================================================================
--- sd/trunk/t/sd-hm-comments1.t (original)
+++ sd/trunk/t/sd-hm-comments1.t Sat Nov 8 03:40:58 2008
@@ -35,6 +35,8 @@
my $sd_hm_url = "hm:$URL";
+run_script('sd', [qw(init)]);
+
my ($yatta_id, $yatta_uuid) = create_ticket_ok( qw(--summary YATTA --status new) );
{
my ( $ret, $out, $err ) = run_script( 'sd', [ 'push','--to', $sd_hm_url ] );
Modified: sd/trunk/t/sd-hm-group.t
==============================================================================
--- sd/trunk/t/sd-hm-group.t (original)
+++ sd/trunk/t/sd-hm-group.t Sat Nov 8 03:40:58 2008
@@ -66,8 +66,10 @@
# pull
{
- eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] ) };
+ eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] ) };
like($out, qr/one changeset/, "only one change");
+ diag($out);
+ diag($err);
}
my ($flyman_uuid, $flyman_id );
@@ -125,7 +127,7 @@
$sd_hm_url = "hm:$URL|group=$gname";
# pull
{
- eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] ) };
+ eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] ) };
like($out, qr/2 changesets/, "merged changes");
}
Modified: sd/trunk/t/sd-hm-tag.t
==============================================================================
--- sd/trunk/t/sd-hm-tag.t (original)
+++ sd/trunk/t/sd-hm-tag.t Sat Nov 8 03:40:58 2008
@@ -54,7 +54,7 @@
my ( $ret, $out, $err );
my $sd_hm_url = "hm:$URL|tag=mytag";
-eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] ) };
+eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] ) };
like($out, qr/one changeset/, "only one change");
my ($flyman_uuid, $flyman_id );
Modified: sd/trunk/t/sd-hm-update.t
==============================================================================
--- sd/trunk/t/sd-hm-update.t (original)
+++ sd/trunk/t/sd-hm-update.t Sat Nov 8 03:40:58 2008
@@ -42,10 +42,12 @@
my ($yatta_uuid, $yatta_id);
{
- my ($ret, $out, $err) = run_script( 'sd', [ 'pull', '--from', $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 ] );
+ diag($out);
+ diag($err);
($yatta_id, $yatta_uuid) = ($1, $2) if $out =~ /^id: (\d+)\s*\((.*)\)/m;
}
Modified: sd/trunk/t/sd-hm.t
==============================================================================
--- sd/trunk/t/sd-hm.t (original)
+++ sd/trunk/t/sd-hm.t Sat Nov 8 03:40:58 2008
@@ -42,7 +42,7 @@
my ( $ret, $out, $err );
my $sd_hm_url = "hm:$URL";
-eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] ) };
+eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] ) };
diag $err;
my ($flyman_uuid, $flyman_id );
Modified: sd/trunk/t/sd-rt-hm-single.t
==============================================================================
--- sd/trunk/t/sd-rt-hm-single.t (original)
+++ sd/trunk/t/sd-rt-hm-single.t Sat Nov 8 03:40:58 2008
@@ -82,7 +82,7 @@
as_bob {
local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
- ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
+ ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', $sd_hm_url ] );
diag($err) if ($err);
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/^(.*?)(?{ $yatta_id = $1 }) YATTA .*/] );
$yatta_uuid = get_uuid_for_luid($yatta_id);
Modified: sd/trunk/t/sd-rt-hm.t
==============================================================================
--- sd/trunk/t/sd-rt-hm.t (original)
+++ sd/trunk/t/sd-rt-hm.t Sat Nov 8 03:40:58 2008
@@ -25,7 +25,7 @@
push @INC, File::Spec->catdir( Jifty::Util->app_root, "lib" );
}
-plan tests => 11;
+plan tests => 10;
RT::Test->import();
@@ -78,9 +78,21 @@
my ( $bob_yatta_id, $bob_flyman_id, $flyman_uuid, $yatta_uuid, $alice_yatta_id, $alice_flyman_id );
my ( $ret, $out, $err );
+as_alice {
+ local $ENV{SD_REPO} = $ENV{PROPHET_REPO};
+ ( $ret, $out, $err ) = run_script('sd',['init']);
+ diag($err) if ($err);
+};
+
+as_bob {
+ local $ENV{SD_REPO} = $ENV{PROPHET_REPO};
+ ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', repo_uri_for('alice') ] );
+ diag($err) if ($err);
+};
+
# now the tests, bob syncs with rt, alice syncs with hm
as_alice {
- local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
+ local $ENV{SD_REPO} = $ENV{PROPHET_REPO};
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
diag($err) if ($err);
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/^(.*?)(?{ $alice_yatta_id = $1 }) YATTA .*/] );
@@ -88,15 +100,13 @@
};
as_bob {
- local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
- run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [] );
-
+ local $ENV{SD_REPO} = $ENV{PROPHET_REPO};
diag("Bob pulling from RT");
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_rt_url ] );
diag($err) if ($err);
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/^(.*?)(?{ $bob_flyman_id = $1 }) Fly Man new/] );
diag("Bob pulling from alice");
- ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', repo_uri_for('alice'), '--force' ] );
+ ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', repo_uri_for('alice')] );
$flyman_uuid = get_uuid_for_luid($bob_flyman_id);
my $bob_yatta_id = get_luid_for_uuid($yatta_uuid);
Modified: sd/trunk/t/sd-rt-n-foreign-sync.t
==============================================================================
--- sd/trunk/t/sd-rt-n-foreign-sync.t (original)
+++ sd/trunk/t/sd-rt-n-foreign-sync.t Sat Nov 8 03:40:58 2008
@@ -96,9 +96,23 @@
my ( $bob_yatta_id, $bob_flyman_id, $flyman_uuid, $yatta_uuid, $alice_yatta_id, $alice_flyman_id );
my ( $ret, $out, $err );
+# start with the same database
+as_alice {
+ local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
+
+ run_script( 'sd', [ 'init']);
+};
+
+as_bob {
+ local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
+
+ ( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', repo_uri_for('alice') ] );
+};
+
# now the tests, bob syncs with rt, alice syncs with hm
as_alice {
local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
+
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
diag($err) if ($err);
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/^(.*?)(?{ $alice_yatta_id = $1 }) YATTA .*/] );
@@ -107,6 +121,7 @@
as_bob {
local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
+
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [] );
diag("Bob pulling from RT");
Modified: sd/trunk/t/sd-rt-permission.t
==============================================================================
--- sd/trunk/t/sd-rt-permission.t (original)
+++ sd/trunk/t/sd-rt-permission.t Sat Nov 8 03:40:58 2008
@@ -19,9 +19,10 @@
require File::Temp;
$ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
diag "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
+
}
-use Prophet::Test tests => 22;
+use Prophet::Test tests => 23;
use App::SD::Test;
use RT::Client::REST;
use RT::Client::REST::Ticket;
@@ -63,14 +64,15 @@
my $sd_alice_url = "rt:$alice_url|General|Status!='resolved'";
as_alice {
- ($ret, $out, $err) = run_script('sd', ['pull', '--from', $sd_alice_url]);
+ run_script( 'sd', [ 'init']);
+ ($ret, $out, $err) = run_script('sd', ['pull', '--from', $sd_alice_url, '--force']);
ok($ret);
like($out, qr/No new changesets/);
TODO: {
local $TODO = "not coming through for some reason";
like($err, qr/No tickets found/);
- }
+ }
};
diag("grant read rights, ensure we can pull it");
@@ -102,9 +104,21 @@
ok($ret);
like($err, qr/You are not allowed to modify ticket $ticket_id/);
+ SKIP: {
+ skip "test needs fixing", 1;
+
+ # we should know exactly how many changesets there are.. used to be 1,
+ # now it's 13. one must fail to be merged but we can still report that
+ # the others (up to but excluding the failure) were successfully merged
+ unlike($out, qr/Merged 12 changesets/);
+ }
+
+ # try again to make sure we still have pending changesets
+ ($ret, $out, $err) = run_script('sd', ['push', '--to', $sd_alice_url]);
+
TODO: {
- local $TODO = "we report success even though it failed";
- unlike($out, qr/Merged one changeset/);
+ local $TODO = "we mark all changesets as merged even if some failed";
+ unlike($out, qr/No new changesets/, "there are still pending changesets");
}
};
Modified: sd/trunk/t/sd-rt.t
==============================================================================
--- sd/trunk/t/sd-rt.t (original)
+++ sd/trunk/t/sd-rt.t Sat Nov 8 03:40:58 2008
@@ -51,7 +51,7 @@
)->store( text => "Ticket Comment" );
my ( $ret, $out, $err );
-( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_rt_url ] );
+( $ret, $out, $err ) = run_script( 'sd', [ 'clone', '--from', $sd_rt_url ] );
my ( $yatta_id, $flyman_id );
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ],
[qr/(.*?)(?{ $flyman_id = $1 }) Fly Man new/] );
@@ -61,6 +61,7 @@
status => 'open',
)->store();
+run_script( 'sd', [ 'init']);
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_rt_url ] );
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], ["$flyman_id Fly Man open"] );
@@ -76,6 +77,8 @@
run_output_matches_unordered( 'sd', [ 'ticket', 'list', '--regex', '.' ], [sort "$yatta_id YATTA new", "$flyman_id Fly Man open" ]);
( $ret, $out, $err ) = run_script( 'sd', [ 'push', '--to', $sd_rt_url ] );
+diag ($out);
+diag ($err);
my @tix = $rt->search(
type => 'ticket',
query => "Subject='YATTA'"
@@ -185,9 +188,9 @@
is ($logo->file_name, 'bplogo.gif');
is ($makefile->file_name, 'Makefile.PL');
-is($makefile->content, $MAKEFILE_CONTENT , " The makefile's content was ropundtripped ot rt ok");
+is($makefile->content, $MAKEFILE_CONTENT , " The makefile's content was roundtripped ot rt ok");
-is($logo->content, file($IMAGE_FILE)->slurp, " The image's content was ropundtripped ot rt ok");
+is($logo->content, file($IMAGE_FILE)->slurp, " The image's content was roundtripped ot rt ok");
#diag $uuid;
Modified: sd/trunk/t/sd-validation.t
==============================================================================
--- sd/trunk/t/sd-validation.t (original)
+++ sd/trunk/t/sd-validation.t Sat Nov 8 03:40:58 2008
@@ -11,6 +11,9 @@
$ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
warn $ENV{'PROPHET_REPO'};
}
+
+run_script( 'sd', [ 'init']);
+
# create from sd and push
my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
More information about the Bps-public-commit
mailing list