From 417ac3ad001cebb9e441a34db9b0f1d145c96385 Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Fri, 22 Jan 2010 14:40:23 +1300 Subject: [PATCH] cil-bf35f2c7: Now doesn't add duplicates --- issues/i_bf35f2c7.cil | 4 ++-- lib/CIL/Issue.pm | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/issues/i_bf35f2c7.cil b/issues/i_bf35f2c7.cil index f5acc53..a61a59f 100644 --- a/issues/i_bf35f2c7.cil +++ b/issues/i_bf35f2c7.cil @@ -1,10 +1,10 @@ Summary: Adding a label twice actually does it -Status: New +Status: Finished CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton Label: Milestone-v0.06 Inserted: 2009-12-05T00:38:49 -Updated: 2010-01-21T22:59:19 +Updated: 2010-01-22T01:39:51 Take an issue with no labels: diff --git a/lib/CIL/Issue.pm b/lib/CIL/Issue.pm index eff317f..77badac 100644 --- a/lib/CIL/Issue.pm +++ b/lib/CIL/Issue.pm @@ -131,6 +131,9 @@ sub add_label { croak 'provide a label when adding one' unless defined $label; + # return if we already have this label + return if grep { $_ eq $label } @{$self->{data}{Label}}; + push @{$self->{data}{Label}}, $label; $self->flag_as_updated(); } -- 2.39.5