cil-b5a4ef93: Finished adding --add and --commit to various commands
authorAndrew Chilton <andychilton@gmail.com>
Fri, 22 Jan 2010 02:16:19 +0000 (15:16 +1300)
committerAndrew Chilton <andychilton@gmail.com>
Fri, 22 Jan 2010 02:16:19 +0000 (15:16 +1300)
issues/i_b5a4ef93.cil
lib/CIL/Command/Label.pm
lib/CIL/Command/Status.pm

index f7074b74a7076cc72a6bc02669eb1a27b90da24e..692f5fbc4a813eb51c6554c6da08597eb10168f1 100644 (file)
@@ -1,12 +1,12 @@
 Summary: Add a '--commit' to 'cil add' (plus some others)
-Status: InProgress
+Status: Finished
 CreatedBy: Andrew Chilton <andychilton@gmail.com>
 AssignedTo: Andrew Chilton <andychilton@gmail.com>
 Label: Milestone-v0.06
 Comment: d98c9a37
 Comment: da74ee18
 Inserted: 2009-12-23T06:27:27
-Updated: 2010-01-22T02:11:48
+Updated: 2010-01-22T02:15:23
 
 When adding a new issue, I usually do:
 
index 8ddd3305be755f92818720764a8a0838bb5c34f9..58f0e1c423663ba99e007a352d904aed43f52704 100644 (file)
@@ -31,7 +31,7 @@ use base qw(CIL::Command);
 sub name { 'label' }
 
 sub run {
-    my ($self, $cil, undef, $label, @issue_names) = @_;
+    my ($self, $cil, $args, $label, @issue_names) = @_;
 
     unless ( defined $label ) {
         CIL::Utils->fatal("provide a valid label to add to this issue");
@@ -45,6 +45,16 @@ sub run {
         # set the status for this issue
         $issue->add_label( $label );
         $issue->save($cil);
+
+        # if we want to add or commit this issue
+        if ( $args->{add} or $args->{commit} ) {
+            $cil->vcs->add( $cil, $issue );
+        }
+
+        # if we want to commit this issue
+        if ( $args->{commit} ) {
+            $cil->vcs->commit( $cil, $issue );
+        }
     }
 }
 
index 529ca7bb42a128810a100ba2ad03d9655b3d246e..60d72d25331c5457718a515b223efc8d5bdc2d21 100644 (file)
@@ -31,7 +31,7 @@ use base qw(CIL::Command);
 sub name { 'status' }
 
 sub run {
-    my ($self, $cil, undef, $status, @issue_names) = @_;
+    my ($self, $cil, $args, $status, @issue_names) = @_;
 
     unless ( defined $status ) {
         CIL::Utils->fatal("provide a valid status to set this issue to");
@@ -45,6 +45,16 @@ sub run {
         # set the label for this issue
         $issue->Status( $status );
         $issue->save($cil);
+
+        # if we want to add or commit this issue
+        if ( $args->{add} or $args->{commit} ) {
+            $cil->vcs->add( $cil, $issue );
+        }
+
+        # if we want to commit this issue
+        if ( $args->{commit} ) {
+            $cil->vcs->commit( $cil, $issue );
+        }
     }
 }