App-Sqitch
view release on metacpan or search on metacpan
lib/App/Sqitch/Command/rebase.pm view on Meta::CPAN
package App::Sqitch::Command::rebase;
use 5.010;
use strict;
use warnings;
use utf8;
use Moo;
use Types::Standard qw(Str Bool);
use Locale::TextDomain qw(App-Sqitch);
use App::Sqitch::X qw(hurl);
use List::Util qw(first);
use Try::Tiny;
use namespace::autoclean;
extends 'App::Sqitch::Command';
with 'App::Sqitch::Role::RevertDeployCommand';
our $VERSION = 'v1.6.1'; # VERSION
has onto_change => (
is => 'ro',
isa => Str,
);
has upto_change => (
is => 'ro',
isa => Str,
);
has modified => (
is => 'ro',
isa => Bool,
default => 0,
);
sub options {
return qw(
onto-change|onto=s
upto-change|upto=s
modified|m
);
}
sub configure {
my ( $class, $config, $opt ) = @_;
return { map { $_ => $opt->{$_} } grep { exists $opt->{$_} } qw(
onto_change
upto_change
modified
) };
}
sub execute {
my $self = shift;
my ($targets, $changes) = $self->parse_args(
target => $self->target,
args => \@_,
);
# Warn on multiple targets.
my $target = shift @{ $targets };
$self->warn(__x(
'Too many targets specified; connecting to {target}',
target => $target->name,
)) if @{ $targets };
# Warn on too many changes.
my $engine = $target->engine;
my $onto = $self->modified
? $engine->planned_deployed_common_ancestor_id
: $self->onto_change // shift @{ $changes };
my $upto = $self->upto_change // shift @{ $changes };
$self->warn(__x(
( run in 0.611 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )