cil-b5a4ef93: Now does the --commit in one got (for multi-entity changes)
authorAndrew Chilton <andychilton@gmail.com>
Sat, 23 Jan 2010 11:22:17 +0000 (00:22 +1300)
committerAndrew Chilton <andychilton@gmail.com>
Sat, 23 Jan 2010 11:22:17 +0000 (00:22 +1300)
lib/CIL/Command/Comment.pm
lib/CIL/VCS/Git.pm

index 35a3c5ea6361bc1095bdbf793549abc5432b9958..ab1e1ba7b2c74913e3527863e6e95a8a16b8fc77 100644 (file)
@@ -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 );
     }
 
 }
index bc048e8084f9c16ddb8c087c8df0b0129a5255f6..1aec18f67172d076fd0663ac1c4c1513c80cfe86 100644 (file)
@@ -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);
 }
 
 ## ----------------------------------------------------------------------------