[Bps-public-commit] App-Changeloggr branch, master, updated. 261c563e43b6466796fc9c275c44d4546fbfcb7c
sartak at bestpractical.com
sartak at bestpractical.com
Tue May 19 10:21:13 EDT 2009
The branch, master has been updated
via 261c563e43b6466796fc9c275c44d4546fbfcb7c (commit)
from 5e62f3dad8e21ae20503079012f86b744906d33f (commit)
Summary of changes:
lib/App/Changeloggr/Model/ChangeCollection.pm | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 261c563e43b6466796fc9c275c44d4546fbfcb7c
Author: Shawn M Moore <sartak at gmail.com>
Date: Tue May 19 10:20:31 2009 -0400
Enforce uniqueness on changes' (changelog, identifier)
diff --git a/lib/App/Changeloggr/Model/ChangeCollection.pm b/lib/App/Changeloggr/Model/ChangeCollection.pm
index 8b4e97c..b1dbad4 100644
--- a/lib/App/Changeloggr/Model/ChangeCollection.pm
+++ b/lib/App/Changeloggr/Model/ChangeCollection.pm
@@ -24,6 +24,18 @@ sub create_from {
while (my $fields = $parser->next_match) {
my $change = App::Changeloggr::Model::Change->new;
+ # If we already have a change with this changelog and identifier,
+ # skip it.
+ my $existing_change = App::Changeloggr::Model::Change->new;
+ $existing_change->load_by_cols(
+ changelog_id => $changelog->id,
+ identifier => $fields->{identifier},
+ );
+ if ($existing_change->id) {
+ $self->log->debug("Skipping identifier $fields->{identifier} for changelog #" . $changelog->id . " since it has a change with that identifier");
+ next;
+ }
+
my ($ok, $msg) = $change->create(
%$fields,
changelog_id => $changelog->id,
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list