summaryrefslogtreecommitdiff
path: root/lib/CIL/Issue.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CIL/Issue.pm')
-rw-r--r--lib/CIL/Issue.pm30
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/CIL/Issue.pm b/lib/CIL/Issue.pm
index eff317f..c1360d0 100644
--- a/lib/CIL/Issue.pm
+++ b/lib/CIL/Issue.pm
@@ -82,6 +82,10 @@ sub prefix {
return 'i';
}
+sub type {
+ return 'Issue';
+}
+
sub fields {
return \@FIELDS;
}
@@ -131,8 +135,22 @@ 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();
+ $self->set_updated_now();
+}
+
+sub remove_label {
+ my ($self, $label) = @_;
+
+ croak 'provide a label when removing one'
+ unless defined $label;
+
+ # remove this label
+ @{$self->{data}{Label}} = grep { $_ ne $label } @{$self->{data}{Label}};
+ $self->set_updated_now();
}
sub add_comment {
@@ -165,8 +183,11 @@ sub add_depends_on {
croak 'provide an issue name when adding a depends'
unless defined $depends;
+ # return if we already have this depends
+ return if grep { $_ eq $depends } @{$self->{data}{DependsOn}};
+
push @{$self->{data}{DependsOn}}, $depends;
- $self->flag_as_updated();
+ $self->set_updated_now();
}
sub add_precedes {
@@ -175,8 +196,11 @@ sub add_precedes {
croak 'provide an issue name when adding a precedes'
unless defined $precedes;
+ # return if we already have this precedes
+ return if grep { $_ eq $precedes } @{$self->{data}{Precedes}};
+
push @{$self->{data}{Precedes}}, $precedes;
- $self->flag_as_updated();
+ $self->set_updated_now();
}
sub LabelList {