From: Andrew Chilton Date: Fri, 22 Jan 2010 02:12:37 +0000 (+1300) Subject: cil-b5a4ef93: Added code for --commit and --add for the comment command X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c98f5e2d85be4b11224424e5df472ff10a4d2db9;p=cil.git cil-b5a4ef93: Added code for --commit and --add for the comment command --- diff --git a/issues/c_d98c9a37.cil b/issues/c_d98c9a37.cil new file mode 100644 index 0000000..6893a10 --- /dev/null +++ b/issues/c_d98c9a37.cil @@ -0,0 +1,6 @@ +Issue: b5a4ef93 +CreatedBy: Andrew Chilton +Inserted: 2010-01-22T02:11:30 +Updated: 2010-01-22T02:11:48 + +Added the code for --add and --commit for 'comment'. diff --git a/issues/i_b5a4ef93.cil b/issues/i_b5a4ef93.cil index 731e1ea..f7074b7 100644 --- a/issues/i_b5a4ef93.cil +++ b/issues/i_b5a4ef93.cil @@ -3,9 +3,10 @@ Status: InProgress CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton 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: diff --git a/lib/CIL/Command/Comment.pm b/lib/CIL/Command/Comment.pm index d47f479..35a3c5e 100644 --- a/lib/CIL/Command/Comment.pm +++ b/lib/CIL/Command/Comment.pm @@ -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;