X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Frgit.git;a=blobdiff_plain;f=lib%2FApp%2FRgit%2FCommand%2FEach.pm;h=7996f3d1795f515ad3f9057368f1128c95f06f73;hp=a42ddb886d988b06ed55fc2ce0e73e6261a93cd7;hb=e267749b5294c865fa9584c6f15bb0af85e24e30;hpb=876aec5a45915d4fe3b4229787c3aa3e6b56f542 diff --git a/lib/App/Rgit/Command/Each.pm b/lib/App/Rgit/Command/Each.pm index a42ddb8..7996f3d 100644 --- a/lib/App/Rgit/Command/Each.pm +++ b/lib/App/Rgit/Command/Each.pm @@ -5,6 +5,8 @@ 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. @@ -37,13 +39,20 @@ sub run { my $self = shift; my $conf = shift; my $status = 0; + my $code; for (@{$conf->repos}) { $_->chdir or next; $status = $_->run($conf, @{$self->args}); - last if $status; + $code = $self->report($conf, $_, $status) unless defined $code; + if ($code & REDO) { + undef $code; # Don't save it, that would be very dumb + redo; + } + last if $code & LAST; + undef $code unless $code & SAVE; } $conf->cwd_repo->chdir; - return $status; + return wantarray ? ($status, $code) : $status; } =head1 SEE ALSO