]> git.mjollnir.org Git - cil.git/commitdiff
cil-b5a4ef93: Added code for --commit and --add for the comment command
authorAndrew Chilton <andychilton@gmail.com>
Fri, 22 Jan 2010 02:12:37 +0000 (15:12 +1300)
committerAndrew Chilton <andychilton@gmail.com>
Fri, 22 Jan 2010 02:12:37 +0000 (15:12 +1300)
issues/c_d98c9a37.cil [new file with mode: 0644]
issues/i_b5a4ef93.cil
lib/CIL/Command/Comment.pm

diff --git a/issues/c_d98c9a37.cil b/issues/c_d98c9a37.cil
new file mode 100644 (file)
index 0000000..6893a10
--- /dev/null
@@ -0,0 +1,6 @@
+Issue: b5a4ef93
+CreatedBy: Andrew Chilton <andychilton@gmail.com>
+Inserted: 2010-01-22T02:11:30
+Updated: 2010-01-22T02:11:48
+
+Added the code for --add and --commit for 'comment'.
index 731e1ea664e9c42983d1a4c81b83f66218057539..f7074b74a7076cc72a6bc02669eb1a27b90da24e 100644 (file)
@@ -3,9 +3,10 @@ Status: InProgress
 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:07:47
+Updated: 2010-01-22T02:11:48
 
 When adding a new issue, I usually do:
 
index d47f479db3f7d8e722278b98094df46ae9a2842a..35a3c5ea6361bc1095bdbf793549abc5432b9958 100644 (file)
@@ -31,7 +31,7 @@ use base qw(CIL::Command);
 sub name { 'comment' }
 
 sub run {
-    my ($self, $cil, undef, $issue_name) = @_;
+    my ($self, $cil, $args, $issue_name) = @_;
 
     my $issue = CIL::Utils->load_issue_fuzzy( $cil, $issue_name );
 
@@ -43,7 +43,20 @@ sub run {
     $comment->CreatedBy( CIL::Utils->user($cil) );
     $comment->Description("Description ...");
 
-    CIL::Utils->add_comment_loop($cil, undef, $issue, $comment);
+    $comment = CIL::Utils->add_comment_loop($cil, undef, $issue, $comment);
+
+    # if we want to add or commit this comment
+    if ( $args->{add} or $args->{commit} ) {
+        $cil->vcs->add( $cil, $issue );
+        $cil->vcs->add( $cil, $comment );
+    }
+
+    # if we want to commit this comment
+    if ( $args->{commit} ) {
+        $cil->vcs->commit( $cil, $issue );
+        $cil->vcs->commit( $cil, $comment );
+    }
+
 }
 
 1;