X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FApp%2FRgit%2FCommand%2FEach.pm;h=c042b71fa5f7ae56de1acab11089388c670e7f29;hb=e5b5b7ba124d526f1e05c83723ee8a9a738e74e1;hp=2981904f8095b11963d54c258fec1b906bbbfa3f;hpb=19bee8f647bfe6c94c5cb3cf6a60d7a43cbca222;p=perl%2Fmodules%2Frgit.git diff --git a/lib/App/Rgit/Command/Each.pm b/lib/App/Rgit/Command/Each.pm index 2981904..c042b71 100644 --- a/lib/App/Rgit/Command/Each.pm +++ b/lib/App/Rgit/Command/Each.pm @@ -5,17 +5,19 @@ use warnings; 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.01 +Version 0.03 =cut -our $VERSION = '0.01'; +our $VERSION = '0.03'; =head1 DESCRIPTION @@ -35,14 +37,22 @@ It implements : 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 = $_->run($conf, @{$self->args}); + $code = $self->report($conf, $_, $status) 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