use base qw/App::Rgit::Command/;
+use App::Rgit::Utils qw/:codes/;
+
=head1 NAME
App::Rgit::Command::Each - Class for commands to execute for each repository.
=head1 VERSION
-Version 0.02
+Version 0.06
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.06';
=head1 DESCRIPTION
sub run {
my $self = shift;
+ my $conf = shift;
my $status = 0;
- for (@{$self->repos}) {
+ my $code;
+ for (@{$conf->repos}) {
$_->chdir or next;
- $status = $_->run($_[0], @{$self->args});
- last if $status;
+ ($status, my $signal) = $_->run($conf, @{$self->args});
+ $code = $self->report($conf, $_, $status, $signal) unless defined $code;
+ last if $code & LAST;
+ if ($code & REDO) {
+ undef $code; # Don't save it, that would be very dumb
+ redo;
+ }
+ undef $code unless $code & SAVE;
}
- $self->cwd_as_repo->chdir;
- return $status;
+ $conf->cwd_repo->chdir;
+ return wantarray ? ($status, $code) : $status;
}
=head1 SEE ALSO
=head1 COPYRIGHT & LICENSE
-Copyright 2008 Vincent Pit, all rights reserved.
+Copyright 2008-2009 Vincent Pit, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.