From e0d462fca194502ba8c1f055459f9ba720cd84cf Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Wed, 2 Jul 2008 22:14:56 +1200 Subject: [PATCH] Finish up the 'DependsOn' and 'Precedes' fields (closes #c98515e2). --- bin/cil | 43 ++++++++++++++++++++++++++++++++++++------- issues/c_7f22c24e.cil | 7 +++++++ issues/i_c98515e2.cil | 5 +++-- 3 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 issues/c_7f22c24e.cil diff --git a/bin/cil b/bin/cil index 6c1e919..4190376 100755 --- a/bin/cil +++ b/bin/cil @@ -374,8 +374,9 @@ sub cmd_fsck { $attachment->{$a->name} = $a; } + # ------ + # issues my $errors = {}; - if ( @$issues ) { foreach my $i ( sort { $a->Inserted cmp $b->Inserted } @$issues ) { my $name = $i->name; @@ -413,14 +414,43 @@ sub cmd_fsck { push @{$errors->{$name}}, "attachment '$a' listed in issue '" . $i->name . "' does not exist"; } } + + # check that all it's 'DependsOn' are there and that they have this under 'Precedes' + my $depends_on = $i->DependsOnList; + foreach my $d ( @$depends_on ) { + # see if this issue exists at all + if ( exists $issue->{$d} ) { + # check the 'Precedes' is this issue + my %precedes = map { $_ => 1 } @{$issue->{$d}->PrecedesList}; + push @{$errors->{$name}}, "issue '$d' should precede '" . $i->name . "' but doesn't" + unless exists $precedes{$i->name}; + } + else { + push @{$errors->{$name}}, "issue '$d' listed as a dependency of issue '" . $i->name . "' does not exist"; + } + } + + # check that all it's 'Precedes' are there and that they have this under 'DependsOn' + my $precedes = $i->PrecedesList; + foreach my $p ( @$precedes ) { + # see if this issue exists at all + if ( exists $issue->{$p} ) { + # check the 'DependsOn' is this issue + my %depends_on = map { $_ => 1 } @{$issue->{$p}->DependsOnList}; + push @{$errors->{$name}}, "issue '$p' should depend on '" . $i->name . "' but doesn't" + unless exists $depends_on{$i->name}; + } + else { + push @{$errors->{$name}}, "issue '$p' listed as preceding issue '" . $i->name . "' does not exist"; + } + } } } - print_fsck_errors('Issue', $errors); + # -------- # comments $errors = {}; - # loop through all the comments if ( @$comments ) { # check that their parent issues exist @@ -431,12 +461,11 @@ sub cmd_fsck { } } } - print_fsck_errors('Comment', $errors); + # ----------- # attachments $errors = {}; - # loop through all the attachments if ( @$attachments ) { # check that their parent issues exist @@ -447,10 +476,10 @@ sub cmd_fsck { } } } - print_fsck_errors('Attachment', $errors); - # nothing more to do + # ------------ + # nothing left separator(); } diff --git a/issues/c_7f22c24e.cil b/issues/c_7f22c24e.cil new file mode 100644 index 0000000..ec8c84e --- /dev/null +++ b/issues/c_7f22c24e.cil @@ -0,0 +1,7 @@ +Issue: c98515e2 +CreatedBy: Andrew Chilton +Inserted: 2008-07-02T10:02:11 +Updated: 2008-07-02T10:02:38 + +Added checks in 'fsck' so that it looks at the 'Precedes' and the 'DependsOn' +fields. diff --git a/issues/i_c98515e2.cil b/issues/i_c98515e2.cil index 562897a..98dc5a7 100644 --- a/issues/i_c98515e2.cil +++ b/issues/i_c98515e2.cil @@ -1,12 +1,13 @@ Summary: Allow dependencies between issues -Status: InProgress +Status: Finished CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton Label: Milestone-v0.4 Label: Type-Enhancement +Comment: 7f22c24e Comment: d87e016d Inserted: 2008-07-01T03:23:39 -Updated: 2008-07-02T09:39:33 +Updated: 2008-07-02T10:03:09 Francois suggested that allowing dependencies between issues would be good. ie. this one here is dependent on that one over there (ie. the -- 2.39.5