From cb054808b4aabd8f23eff294593e2e443aa20c7d Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Fri, 22 Jan 2010 15:16:19 +1300 Subject: [PATCH] cil-b5a4ef93: Finished adding --add and --commit to various commands --- issues/i_b5a4ef93.cil | 4 ++-- lib/CIL/Command/Label.pm | 12 +++++++++++- lib/CIL/Command/Status.pm | 12 +++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/issues/i_b5a4ef93.cil b/issues/i_b5a4ef93.cil index f7074b7..692f5fb 100644 --- a/issues/i_b5a4ef93.cil +++ b/issues/i_b5a4ef93.cil @@ -1,12 +1,12 @@ Summary: Add a '--commit' to 'cil add' (plus some others) -Status: InProgress +Status: Finished CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton 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: diff --git a/lib/CIL/Command/Label.pm b/lib/CIL/Command/Label.pm index 8ddd330..58f0e1c 100644 --- a/lib/CIL/Command/Label.pm +++ b/lib/CIL/Command/Label.pm @@ -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 ); + } } } diff --git a/lib/CIL/Command/Status.pm b/lib/CIL/Command/Status.pm index 529ca7b..60d72d2 100644 --- a/lib/CIL/Command/Status.pm +++ b/lib/CIL/Command/Status.pm @@ -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 ); + } } } -- 2.39.5