]> git.mjollnir.org Git - cil.git/commitdiff
Finish up the 'DependsOn' and 'Precedes' fields (closes #c98515e2).
authorAndrew Chilton <andychilton@gmail.com>
Wed, 2 Jul 2008 10:14:56 +0000 (22:14 +1200)
committerAndrew Chilton <andychilton@gmail.com>
Wed, 2 Jul 2008 10:14:56 +0000 (22:14 +1200)
bin/cil
issues/c_7f22c24e.cil [new file with mode: 0644]
issues/i_c98515e2.cil

diff --git a/bin/cil b/bin/cil
index 6c1e919912644a84fb728facaf39b07ae36098d8..4190376d6b2b9f5375252bb755e999ebe49b2a7b 100755 (executable)
--- 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 (file)
index 0000000..ec8c84e
--- /dev/null
@@ -0,0 +1,7 @@
+Issue: c98515e2
+CreatedBy: Andrew Chilton <andychilton@gmail.com>
+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.
index 562897a42986a0df65feeff4a89ed448a0e3c3b5..98dc5a79a0bfc391b689d78ee53156c598aa2e34 100644 (file)
@@ -1,12 +1,13 @@
 Summary: Allow dependencies between issues
-Status: InProgress
+Status: Finished
 CreatedBy: Andrew Chilton <andychilton@gmail.com>
 AssignedTo: Andrew Chilton <andychilton@gmail.com>
 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