X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FApp%2FRgit%2FCommand%2FEach.pm;h=c042b71fa5f7ae56de1acab11089388c670e7f29;hb=e5b5b7ba124d526f1e05c83723ee8a9a738e74e1;hp=2825ef67eed03bb6956cde4d6bd9e71f76adebc4;hpb=6106b02a51da37eadcc29155ae4d51c07fff61ce;p=perl%2Fmodules%2Frgit.git diff --git a/lib/App/Rgit/Command/Each.pm b/lib/App/Rgit/Command/Each.pm index 2825ef6..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.02 +Version 0.03 =cut -our $VERSION = '0.02'; +our $VERSION = '0.03'; =head1 DESCRIPTION @@ -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; + 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