[Bps-public-commit] r12466 - in Prophet/branches/moose: . lib/Prophet/Meta lib/Prophet/Resolver
sartak at bestpractical.com
sartak at bestpractical.com
Sat May 17 06:54:03 EDT 2008
Author: sartak
Date: Sat May 17 06:54:02 2008
New Revision: 12466
Modified:
Prophet/branches/moose/ (props changed)
Prophet/branches/moose/lib/Prophet/Conflict.pm
Prophet/branches/moose/lib/Prophet/Meta/Types.pm
Prophet/branches/moose/lib/Prophet/Resolver/AlwaysTarget.pm
Log:
r56200 at onn: sartak | 2008-05-17 06:53:38 -0400
Add a FileOpConflict, avoid related undef warnings, and don't pass in an undef file_op_conflict into ConflictingChange's constructor
Modified: Prophet/branches/moose/lib/Prophet/Conflict.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/Conflict.pm (original)
+++ Prophet/branches/moose/lib/Prophet/Conflict.pm Sat May 17 06:54:02 2008
@@ -108,7 +108,7 @@
sub _generate_change_conflicts {
my $self = shift;
my ($change) = validate_pos( @_, { isa => "Prophet::Change" } );
- my $file_op_conflict = '';
+ my $file_op_conflict;
my $file_exists = $self->prophet_handle->record_exists( uuid => $change->record_uuid, type => $change->record_type );
@@ -130,7 +130,7 @@
record_uuid => $change->record_uuid,
target_record_exists => $file_exists,
change_type => $change->change_type,
- file_op_conflict => $file_op_conflict
+ $file_op_conflict ? (file_op_conflict => $file_op_conflict) : (),
}
);
@@ -213,13 +213,14 @@
my $nullify_conflict
= Prophet::Change->new( { record_type => $conflict->record_type, record_uuid => $conflict->record_uuid } );
- if ( $conflict->file_op_conflict eq "delete_missing_file" ) {
+ my $file_op_conflict = $conflict->file_op_conflict || '';
+ if ( $file_op_conflict eq "delete_missing_file" ) {
$nullify_conflict->change_type('add_file');
- } elsif ( $conflict->file_op_conflict eq "update_missing_file" ) {
+ } elsif ( $file_op_conflict eq "update_missing_file" ) {
$nullify_conflict->change_type('add_file');
- } elsif ( $conflict->file_op_conflict eq "create_existing_file" ) {
+ } elsif ( $file_op_conflict eq "create_existing_file" ) {
$nullify_conflict->change_type('delete');
- } elsif ( $conflict->file_op_conflict ) {
+ } elsif ( $file_op_conflict ) {
die "We don't know how to deal with a conflict of type " . $conflict->file_op_conflict;
} else {
$nullify_conflict->change_type('update_file');
Modified: Prophet/branches/moose/lib/Prophet/Meta/Types.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/Meta/Types.pm (original)
+++ Prophet/branches/moose/lib/Prophet/Meta/Types.pm Sat May 17 06:54:02 2008
@@ -5,6 +5,7 @@
use Moose::Util::TypeConstraints;
enum 'Prophet::Type::ChangeType' => qw/add_file add_dir update_file delete/;
+enum 'Prophet::Type::FileOpConflict' => qw/delete_missing_file update_missing_file create_existing_file create_existing_dir/;
1;
Modified: Prophet/branches/moose/lib/Prophet/Resolver/AlwaysTarget.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/Resolver/AlwaysTarget.pm (original)
+++ Prophet/branches/moose/lib/Prophet/Resolver/AlwaysTarget.pm Sat May 17 06:54:02 2008
@@ -10,12 +10,13 @@
my $conflicting_change = shift;
my $conflict = shift;
my $resolution = Prophet::Change->new_from_conflict($conflicting_change);
- if ( $conflicting_change->file_op_conflict eq 'update_missing_file' ) {
+ my $file_op_conflict = $conflicting_change->file_op_conflict || '';
+ if ( $file_op_conflict eq 'update_missing_file' ) {
$resolution->change_type('delete');
return $resolution;
- } elsif ( $conflicting_change->file_op_conflict eq 'delete_missing_file' ) {
+ } elsif ( $file_op_conflict eq 'delete_missing_file' ) {
return $resolution;
- } elsif ( $conflicting_change->file_op_conflict ) {
+ } elsif ( $file_op_conflict ) {
die Dumper($conflict,$conflicting_change);
}
More information about the Bps-public-commit
mailing list