[Bps-public-commit] r12496 - in Prophet/branches/moose: .
sartak at bestpractical.com
sartak at bestpractical.com
Sat May 17 09:18:37 EDT 2008
Author: sartak
Date: Sat May 17 09:18:37 2008
New Revision: 12496
Modified:
Prophet/branches/moose/ (props changed)
Prophet/branches/moose/lib/Prophet/Conflict.pm
Prophet/branches/moose/lib/Prophet/Replica.pm
Log:
r56239 at onn: sartak | 2008-05-17 09:18:32 -0400
Add smarts to Conflict->conflicting_changes
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 09:18:37 2008
@@ -1,5 +1,6 @@
package Prophet::Conflict;
use Moose;
+use MooseX::AttributeHelpers;
use Params::Validate;
use Prophet::ConflictingPropChange;
use Prophet::ConflictingChange;
@@ -36,6 +37,17 @@
isa => 'Bool',
);
+has conflicting_changes => (
+ metaclass => 'Collection::Array',
+ is => 'ro',
+ isa => 'ArrayRef[Prophet::ConflictingChange]',
+ default => sub { [] },
+ provides => {
+ count => 'has_conflicting_changes',
+ push => 'add_conflicting_change',
+ },
+);
+
=head2 analyze_changeset Prophet::ChangeSet
Take a look at a changeset. if there are any conflicts, populate
@@ -50,7 +62,7 @@
#my ($changeset) = validate_pos( @_, { isa => 'Prophet::ChangeSet' } );
$self->generate_changeset_conflicts();
- return unless ( @{ $self->conflicting_changes } );
+ return unless $self->has_conflicting_changes;
$self->generate_nullification_changeset;
@@ -94,7 +106,7 @@
my $self = shift;
for my $change ( $self->changeset->changes ) {
if ( my $change_conflicts = $self->_generate_change_conflicts($change) ) {
- push @{ $self->conflicting_changes }, $change_conflicts;
+ $self->add_conflicting_change($change_conflicts);
}
}
}
@@ -180,19 +192,6 @@
return @prop_conflicts;
}
-=head2 conflicting_changes
-
-Returns a referencew to an array of conflicting changes for this conflict
-
-
-=cut
-
-sub conflicting_changes {
- my $self = shift;
- $self->{'conflicting_changes'} ||= [];
- return $self->{'conflicting_changes'};
-}
-
=head2 generate_nullification_changeset
In order to record a changeset which might not apply cleanly to the
Modified: Prophet/branches/moose/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/Replica.pm (original)
+++ Prophet/branches/moose/lib/Prophet/Replica.pm Sat May 17 09:18:37 2008
@@ -351,7 +351,7 @@
$conflict->analyze_changeset();
- return undef unless @{ $conflict->conflicting_changes };
+ return undef unless $conflict->has_conflicting_changes;
return $conflict;
More information about the Bps-public-commit
mailing list