From 228f40b75d56c3f47261dfa792844699e904ee28 Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Sun, 24 Jan 2010 00:22:17 +1300 Subject: [PATCH] cil-b5a4ef93: Now does the --commit in one got (for multi-entity changes) --- lib/CIL/Command/Comment.pm | 3 +-- lib/CIL/VCS/Git.pm | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/CIL/Command/Comment.pm b/lib/CIL/Command/Comment.pm index 35a3c5e..ab1e1ba 100644 --- a/lib/CIL/Command/Comment.pm +++ b/lib/CIL/Command/Comment.pm @@ -53,8 +53,7 @@ sub run { # if we want to commit this comment if ( $args->{commit} ) { - $cil->vcs->commit( $cil, $issue ); - $cil->vcs->commit( $cil, $comment ); + $cil->vcs->commit( $cil, $issue, $comment ); } } diff --git a/lib/CIL/VCS/Git.pm b/lib/CIL/VCS/Git.pm index bc048e8..1aec18f 100644 --- a/lib/CIL/VCS/Git.pm +++ b/lib/CIL/VCS/Git.pm @@ -109,18 +109,27 @@ sub create_branch { } sub add { - my ($self, $cil, $entity) = @_; + my ($self, $cil, @entities) = @_; - my $filename = $entity->filename($cil, $entity->name()); - return $self->git->command('add', $filename); + my @filenames; + foreach my $entity ( @entities ) { + my $filename = $entity->filename($cil, $entity->name()); + push @filenames, $filename; + } + return $self->git->command('add', @filenames); } sub commit { - my ($self, $cil, $entity) = @_; + my ($self, $cil, @entities) = @_; + + my @filenames; + foreach my $entity ( @entities ) { + my $filename = $entity->filename($cil, $entity->name()); + push @filenames, $filename; + } - my $filename = $entity->filename($cil, $entity->name()); - my $message = 'cil-' . $entity->name . ': New Issue'; - return $self->git->command('commit', '-m', $message, $filename); + my $message = 'cil-' . $entities[0]->name . ': New Comment'; + return $self->git->command('commit', '-m', $message, @filenames); } ## ---------------------------------------------------------------------------- -- 2.39.5