[Bps-public-commit] Prophet branch, master, updated. 5d20be612e9f5902cb9f8d812ea00623694e3624
jesse
jesse at bestpractical.com
Tue Apr 14 03:38:58 EDT 2009
The branch, master has been updated
via 5d20be612e9f5902cb9f8d812ea00623694e3624 (commit)
via 067ba6065efbfa6a0d467202c4573b19e4ced800 (commit)
via a9c0a1b9a83702bba7561178541df8c5b6593831 (commit)
via cb83c8a872a5625294dec566b4daa021a8d18b99 (commit)
via c20261ee339d9f5db3b1aa7b2ffe19e7e7f0bf24 (commit)
via bfd571a750372f6c2859d9034adae4dad3d3a618 (commit)
from 2ef0d5a75ab66f0b324c9a0b64ea91091dacd0f9 (commit)
Summary of changes:
lib/Prophet/App.pm | 7 +++++++
lib/Prophet/CLI/Command/Aliases.pm | 2 +-
lib/Prophet/CLI/Command/Clone.pm | 6 ++++++
lib/Prophet/CLI/Command/Server.pm | 2 +-
lib/Prophet/CLIContext.pm | 8 ++++++++
lib/Prophet/Record.pm | 5 ++++-
lib/Prophet/Replica.pm | 5 ++++-
lib/Prophet/Server/View.pm | 2 +-
lib/Prophet/Test.pm | 5 ++---
lib/Prophet/Test/Participant.pm | 4 ++--
t/export.t | 2 +-
t/log.t | 8 ++++----
t/publish-pull.t | 4 ++--
t/real-conflicting-merge.t | 8 ++++----
t/simple-conflicting-merge.t | 6 +++---
t/simple-push.t | 8 ++++----
16 files changed, 54 insertions(+), 28 deletions(-)
- Log -----------------------------------------------------------------
commit bfd571a750372f6c2859d9034adae4dad3d3a618
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Apr 10 15:01:26 2009 -0400
no longer throw away the raw argv.
diff --git a/lib/Prophet/CLIContext.pm b/lib/Prophet/CLIContext.pm
index ab0e7f8..e0768fe 100644
--- a/lib/Prophet/CLIContext.pm
+++ b/lib/Prophet/CLIContext.pm
@@ -33,6 +33,13 @@ has args => (
"This is a reference to the key-value pairs passed in on the commandline",
);
+has raw_args => (
+ is => 'rw',
+ isa => 'ArrayRef',
+ default => sub {[]},
+);
+
+
sub set_arg { $_[0]->args->{$_[1]} = $_[2] }
sub arg { $_[0]->args->{$_[1]} }
sub has_arg { exists $_[0]->args->{$_[1]} }
@@ -147,6 +154,7 @@ looks like an @ARGV.
sub setup_from_args {
my $self = shift;
+ $self->raw_args([@_]);
$self->parse_args(@_);
$self->set_type_and_uuid();
commit c20261ee339d9f5db3b1aa7b2ffe19e7e7f0bf24
Merge: bfd571a... 2ef0d5a...
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Sat Apr 11 22:15:20 2009 -0400
Merge branch 'master' of code.bestpractical.com:/git/prophet
commit cb83c8a872a5625294dec566b4daa021a8d18b99
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Apr 13 15:13:54 2009 -0400
Don't perform a record update when no properties are updated
diff --git a/lib/Prophet/Record.pm b/lib/Prophet/Record.pm
index 1caaa5d..b33af00 100644
--- a/lib/Prophet/Record.pm
+++ b/lib/Prophet/Record.pm
@@ -325,6 +325,9 @@ sub set_props {
$self->canonicalize_props( $args{'props'} );
$self->validate_props( $args{'props'} ) || return undef;
+
+ return 0 unless grep { defined } values %{$args{props}};
+
$self->handle->set_record_props(
type => $self->type,
uuid => $self->uuid,
commit a9c0a1b9a83702bba7561178541df8c5b6593831
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Apr 14 10:38:07 2009 +0900
Switch from using username as the creator of a changeset to email address
diff --git a/lib/Prophet/App.pm b/lib/Prophet/App.pm
index 8c7d55e..9f09765 100644
--- a/lib/Prophet/App.pm
+++ b/lib/Prophet/App.pm
@@ -241,6 +241,13 @@ sub log_fatal {
Carp::confess(@_);
}
+
+sub current_user_email {
+ my $self = shift;
+ return $self->config->get('email_address') || $ENV{'PROPHET_EMAIL'} || $ENV{'EMAIL'};
+
+}
+
__PACKAGE__->meta->make_immutable;
no Any::Moose;
1;
diff --git a/lib/Prophet/CLI/Command/Server.pm b/lib/Prophet/CLI/Command/Server.pm
index b453a5e..5b0ff2a 100644
--- a/lib/Prophet/CLI/Command/Server.pm
+++ b/lib/Prophet/CLI/Command/Server.pm
@@ -8,8 +8,8 @@ use Prophet::Server;
sub run {
my $self = shift;
- Prophet::CLI->end_pager();
my $server = $self->setup_server();
+ Prophet::CLI->end_pager();
$server->run;
}
diff --git a/lib/Prophet/Record.pm b/lib/Prophet/Record.pm
index b33af00..5caee82 100644
--- a/lib/Prophet/Record.pm
+++ b/lib/Prophet/Record.pm
@@ -549,7 +549,7 @@ sub default_props {
=head2 default_prop_creator
-Default the creator of every record to the changeset_creator (usually C<$USER>)
+Default the creator of every record to the changeset_creator (usually the current user's email address.)
=cut
diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index 6cd1961..818d364 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -1046,7 +1046,10 @@ The string to use as the creator of a changeset.
=cut
-sub changeset_creator { $ENV{PROPHET_USER} || $ENV{USER} }
+sub changeset_creator {
+ my $self = shift;
+ return $self->app_handle->current_user_email;
+}
=head2 display_name_for_uuid [uuid]
diff --git a/lib/Prophet/Server/View.pm b/lib/Prophet/Server/View.pm
index 412882c..8db284b 100644
--- a/lib/Prophet/Server/View.pm
+++ b/lib/Prophet/Server/View.pm
@@ -273,7 +273,7 @@ sub generate_changeset_feed {
my $feed = XML::Atom::SimpleFeed->new(
id => "urn:uuid:" . $handle->uuid,
title => $title,
- author => $ENV{USER},
+ author => $self->app_handle->current_user_email,
);
my $newest = $handle->latest_sequence_no;
diff --git a/lib/Prophet/Test.pm b/lib/Prophet/Test.pm
index ce68ee1..49bb615 100644
--- a/lib/Prophet/Test.pm
+++ b/lib/Prophet/Test.pm
@@ -68,7 +68,7 @@ sub import_extra {
}
delete $ENV{'PROPHET_APP_CONFIG'};
- $ENV{'EMAIL'} = 'nobody at example.com';
+ $ENV{'PROPHET_EMAIL'} = 'nobody at example.com';
}
=head2 in_gladiator($code)
@@ -177,9 +177,8 @@ our %DATABASE_UUIDS;
sub as_user {
my $username = shift;
my $coderef = shift;
- local $ENV{'PROPHET_USER'} = $username;
local $ENV{'PROPHET_REPO'} = repo_path_for($username);
- local $ENV{'EMAIL'} = $username . '@example.com';
+ local $ENV{'PROPHET_EMAIL'} = $username . '@example.com';
my $ret = $coderef->();
diff --git a/lib/Prophet/Test/Participant.pm b/lib/Prophet/Test/Participant.pm
index 2f22cd8..887beb7 100644
--- a/lib/Prophet/Test/Participant.pm
+++ b/lib/Prophet/Test/Participant.pm
@@ -168,8 +168,8 @@ sub call_func_ok {
my @ret;
lives_and {
@ret = call_func(@args);
- diag("As ".$ENV{'PROPHET_USER'}. " ".join(' ',@{$args[0]}));
- ok( 1, join( " ", $ENV{'PROPHET_USER'}, @{ $args[0] } ) );
+ diag("As ".$ENV{'PROPHET_EMAIL'}. " ".join(' ',@{$args[0]}));
+ ok( 1, join( " ", $ENV{'PROPHET_EMAIL'}, @{ $args[0] } ) );
};
return @ret;
}
diff --git a/t/export.t b/t/export.t
index 3c1466d..9ef799a 100644
--- a/t/export.t
+++ b/t/export.t
@@ -40,7 +40,7 @@ as_bob {
['show', '--type', 'Bug', '--uuid', $record_id, '--batch'],
[
qr/id: (\d+) \($record_id\)/,
- 'creator: alice',
+ 'creator: alice at example.com',
'from: alice',
'original_replica: ' . replica_uuid_for('alice'),
'status: stalled',
diff --git a/t/log.t b/t/log.t
index 61afce0..5c0f94a 100644
--- a/t/log.t
+++ b/t/log.t
@@ -65,19 +65,19 @@ is($end, $handle->latest_sequence_no, 'LATEST ends at latest');
# run the command and test its output
my $replica_uuid = replica_uuid;
-my $first = " $ENV{USER}".' at \d{4}-\d{2}-\d{2} .+ \(1\@'.$replica_uuid.'\)
+my $first = " $ENV{PROPHET_EMAIL}".' at \d{4}-\d{2}-\d{2} .+ \(1\@'.$replica_uuid.'\)
# Person 1 \(\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\)
\+ "original_replica" set to "'.$replica_uuid.'"
- \+ "creator" set to "'.$ENV{USER}.'"
+ \+ "creator" set to "'.$ENV{PROPHET_EMAIL}.'"
\+ "name" set to "Mao"
\+ "species" set to "cat"
\+ "age" set to "0.7"';
-my $second = " $ENV{USER}".' at \d{4}-\d{2}-\d{2} .+ \(2\@'.$replica_uuid.'\)
+my $second = " $ENV{PROPHET_EMAIL}".' at \d{4}-\d{2}-\d{2} .+ \(2\@'.$replica_uuid.'\)
# Person 1 \(\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\)
> "age" changed from "0.7" to "1"\.';
-my $third = " $ENV{USER}".' at \d{4}-\d{2}-\d{2} .+ \(3\@'.$replica_uuid.'\)
+my $third = " $ENV{PROPHET_EMAIL}".' at \d{4}-\d{2}-\d{2} .+ \(3\@'.$replica_uuid.'\)
# Person 1 \(\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\)
\+ "color" set to "black"';
diff --git a/t/publish-pull.t b/t/publish-pull.t
index dfd3ada..d532fd6 100644
--- a/t/publish-pull.t
+++ b/t/publish-pull.t
@@ -115,7 +115,7 @@ sub changeset_ok {
},
creator => {
old_value => undef,
- new_value => 'alice',
+ new_value => 'alice at example.com',
},
original_replica => {
old_value => undef,
@@ -137,7 +137,7 @@ sub changeset_ok {
}
is_deeply($changeset, {
- creator => 'alice',
+ creator => 'alice at example.com',
created => $changeset->{created},
is_resolution => undef,
is_nullification => undef,
diff --git a/t/real-conflicting-merge.t b/t/real-conflicting-merge.t
index 599b2f1..92976db 100644
--- a/t/real-conflicting-merge.t
+++ b/t/real-conflicting-merge.t
@@ -36,7 +36,7 @@ as_bob {
[ 'show', '--type', 'Bug', '--uuid', $record_id, '--batch' ],
[
qr/id: (\d+) \($record_id\)/,
- 'creator: alice',
+ 'creator: alice at example.com',
'from: alice',
'original_replica: ' . replica_uuid_for('alice'),
'status: stalled',
@@ -53,7 +53,7 @@ as_alice {
[ 'show', '--type', 'Bug', '--uuid', $record_id, '--batch' ],
[
qr/id: (\d+) \($record_id\)/,
- 'creator: alice',
+ 'creator: alice at example.com',
'from: alice',
'original_replica: ' . replica_uuid_for('alice'),
'status: open',
@@ -191,7 +191,7 @@ sub check_bob_final_state_ok {
original_source_uuid => replica_uuid(),
},
{
- creator => 'alice',
+ creator => 'alice at example.com',
created => $changesets[1]->created,
is_nullification => undef,
is_resolution => undef,
@@ -213,7 +213,7 @@ sub check_bob_final_state_ok {
},
{
- creator => 'bob',
+ creator => 'bob at example.com',
created => $changesets[2]->created,
is_nullification => undef,
is_resolution => 1,
diff --git a/t/simple-conflicting-merge.t b/t/simple-conflicting-merge.t
index a7ec66d..426813c 100644
--- a/t/simple-conflicting-merge.t
+++ b/t/simple-conflicting-merge.t
@@ -34,7 +34,7 @@ as_bob {
[ 'show', '--batch', '--type', 'Bug', '--uuid', $record_id ],
[
qr/id: (\d+) \($record_id\)/,
- 'creator: alice',
+ 'creator: alice at example.com',
'from: alice',
'original_replica: ' . replica_uuid_for('alice'),
'status: stalled',
@@ -57,7 +57,7 @@ as_alice {
['show', '--type', 'Bug', '--uuid', $record_id, '--batch', ],
[
qr/id: (\d+) \($record_id\)/,
- 'creator: alice',
+ 'creator: alice at example.com',
'from: alice',
'original_replica: ' . replica_uuid_for('alice'),
'status: stalled',
@@ -159,7 +159,7 @@ as_bob {
is_deeply(
$from_alice_as_hash,
{
- creator => 'alice',
+ creator => 'alice at example.com',
created => undef,
is_nullification => undef,
is_resolution => undef,
diff --git a/t/simple-push.t b/t/simple-push.t
index 72b891a..7a04797 100644
--- a/t/simple-push.t
+++ b/t/simple-push.t
@@ -91,7 +91,7 @@ my $orig_seq = delete $changesets->[0]->{'original_sequence_no'};
is( $seq, $orig_seq );
my $cs_data = [ { #'sequence_no' => 3,
#'original_sequence_no' => 3, # the number is different on different replica types
- 'creator' => 'bob',
+ 'creator' => 'bob at example.com',
'created' => $changesets->[0]->{created},
'original_source_uuid' => replica_uuid_for('bob'),
'is_resolution' => undef,
@@ -109,7 +109,7 @@ my $cs_data = [ { #'sequence_no' => 3,
'old_value' => undef
},
'creator' => {
- 'new_value' => 'bob',
+ 'new_value' => 'bob at example.com',
'old_value' => undef
},
'original_replica' => {
@@ -177,7 +177,7 @@ is( delete $new_changesets->[0]->{'sequence_no'},
# 'sequence_no' => 4, # the number varies based on replica type
# 'original_sequence_no' => 4,
- 'creator' => 'bob',
+ 'creator' => 'bob at example.com',
'created' => $new_changesets->[0]->{created},
'original_source_uuid' => replica_uuid_for('bob'),
'is_resolution' => undef,
@@ -195,7 +195,7 @@ is( delete $new_changesets->[0]->{'sequence_no'},
'old_value' => undef
},
'creator' => {
- 'new_value' => 'bob',
+ 'new_value' => 'bob at example.com',
'old_value' => undef,
},
'original_replica' => {
commit 067ba6065efbfa6a0d467202c4573b19e4ced800
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Apr 14 11:37:39 2009 +0900
Fix a missing '
diff --git a/lib/Prophet/CLI/Command/Aliases.pm b/lib/Prophet/CLI/Command/Aliases.pm
index 5cadcb1..0875bbb 100644
--- a/lib/Prophet/CLI/Command/Aliases.pm
+++ b/lib/Prophet/CLI/Command/Aliases.pm
@@ -132,7 +132,7 @@ sub process_template {
}
for my $delete ( @deleted ) {
- print 'Deleted alias ' . "'$delete\n";
+ print "Deleted alias '$delete'\n";
}
$self->app_handle->config->set(_aliases => $config );
commit 5d20be612e9f5902cb9f8d812ea00623694e3624
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Apr 14 11:58:36 2009 +0900
Abort replica craetion on clone when the source replica doesn't exist.
Resolves 483DF15C-E80A-11DD-933B-85E68E31E82D
diff --git a/lib/Prophet/CLI/Command/Clone.pm b/lib/Prophet/CLI/Command/Clone.pm
index e6ae1da..6aae8f8 100644
--- a/lib/Prophet/CLI/Command/Clone.pm
+++ b/lib/Prophet/CLI/Command/Clone.pm
@@ -35,6 +35,12 @@ sub run {
resdb_uuid => $source->resolution_db_handle->db_uuid,
);
}
+
+ unless ($source->replica_exists) {
+ print "The source replica '@{[$source->url]}' doesn't exist or is unreadable.";
+ exit 1;
+ }
+
$target->initialize(%init_args);
$self->app_handle->config->set(
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list