line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
3
|
2
|
|
|
2
|
|
2105
|
use strict; |
|
2
|
|
|
|
|
7
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
37
|
|
5
|
2
|
|
|
2
|
|
9
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
47
|
|
6
|
2
|
|
|
2
|
|
10
|
use Moo; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
12
|
|
7
|
2
|
|
|
2
|
|
53
|
use Types::Standard qw(Str Bool); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
663
|
use Locale::TextDomain qw(App-Sqitch); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
24
|
|
9
|
2
|
|
|
2
|
|
1610
|
use App::Sqitch::X qw(hurl); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
15
|
|
10
|
2
|
|
|
2
|
|
347
|
use List::Util qw(first); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
25
|
|
11
|
2
|
|
|
2
|
|
570
|
use Try::Tiny; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
132
|
|
12
|
2
|
|
|
2
|
|
13
|
use namespace::autoclean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
108
|
|
13
|
2
|
|
|
2
|
|
12
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
14
|
|
|
|
|
|
|
extends 'App::Sqitch::Command'; |
15
|
|
|
|
|
|
|
with 'App::Sqitch::Role::RevertDeployCommand'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 'v1.3.0'; # VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has onto_change => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => Str, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has upto_change => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => Str, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has modified => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => Bool, |
32
|
|
|
|
|
|
|
default => 0, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return qw( |
36
|
|
|
|
|
|
|
onto-change|onto=s |
37
|
|
|
|
|
|
|
upto-change|upto=s |
38
|
|
|
|
|
|
|
modified|m |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my ( $class, $config, $opt ) = @_; |
43
|
|
|
|
|
|
|
return { map { $_ => $opt->{$_} } grep { exists $opt->{$_} } qw( |
44
|
|
|
|
|
|
|
onto_change |
45
|
|
|
|
|
|
|
upto_change |
46
|
|
|
|
|
|
|
modified |
47
|
|
|
|
|
|
|
) }; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
my ($targets, $changes) = $self->parse_args( |
52
|
|
|
|
|
|
|
target => $self->target, |
53
|
|
|
|
|
|
|
args => \@_, |
54
|
14
|
|
|
14
|
1
|
37779
|
); |
55
|
14
|
|
|
|
|
54
|
|
56
|
|
|
|
|
|
|
# Warn on multiple targets. |
57
|
|
|
|
|
|
|
my $target = shift @{ $targets }; |
58
|
|
|
|
|
|
|
$self->warn(__x( |
59
|
|
|
|
|
|
|
'Too many targets specified; connecting to {target}', |
60
|
|
|
|
|
|
|
target => $target->name, |
61
|
12
|
|
|
|
|
365
|
)) if @{ $targets }; |
|
12
|
|
|
|
|
23
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Warn on too many changes. |
64
|
|
|
|
|
|
|
my $engine = $target->engine; |
65
|
12
|
100
|
|
|
|
15
|
my $onto = $self->modified |
|
12
|
|
|
|
|
31
|
|
66
|
|
|
|
|
|
|
? $engine->planned_deployed_common_ancestor_id |
67
|
|
|
|
|
|
|
: $self->onto_change // shift @{ $changes }; |
68
|
12
|
|
|
|
|
668
|
my $upto = $self->upto_change // shift @{ $changes }; |
69
|
|
|
|
|
|
|
$self->warn(__x( |
70
|
|
|
|
|
|
|
'Too many changes specified; rebasing onto "{onto}" up to "{upto}"', |
71
|
12
|
100
|
100
|
|
|
1819
|
onto => $onto, |
|
5
|
|
|
|
|
11
|
|
72
|
12
|
|
100
|
|
|
34
|
upto => $upto, |
|
6
|
|
|
|
|
14
|
|
73
|
|
|
|
|
|
|
)) if @{ $changes }; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Now get to work. |
76
|
|
|
|
|
|
|
$engine->with_verify( $self->verify ); |
77
|
12
|
100
|
|
|
|
15
|
$engine->no_prompt( $self->no_prompt ); |
|
12
|
|
|
|
|
27
|
|
78
|
|
|
|
|
|
|
$engine->prompt_accept( $self->prompt_accept ); |
79
|
|
|
|
|
|
|
$engine->log_only( $self->log_only ); |
80
|
12
|
|
|
|
|
330
|
$engine->lock_timeout( $self->lock_timeout ); |
81
|
12
|
|
|
|
|
408
|
|
82
|
12
|
|
|
|
|
394
|
# Revert. |
83
|
12
|
|
|
|
|
380
|
$engine->set_variables( $self->_collect_revert_vars($target) ); |
84
|
12
|
|
|
|
|
365
|
try { |
85
|
|
|
|
|
|
|
$engine->revert( $onto ); |
86
|
|
|
|
|
|
|
} catch { |
87
|
12
|
|
|
|
|
459
|
# Rethrow unknown errors or errors with exitval > 1. |
88
|
|
|
|
|
|
|
die $_ if ! eval { $_->isa('App::Sqitch::X') } |
89
|
12
|
|
|
12
|
|
521
|
|| $_->exitval > 1 |
90
|
|
|
|
|
|
|
|| $_->ident eq 'revert:confirm'; |
91
|
|
|
|
|
|
|
# Emit notice of non-fatal errors (e.g., nothing to revert). |
92
|
4
|
100
|
100
|
4
|
|
1228
|
$self->info($_->message) |
|
4
|
|
100
|
|
|
54
|
|
93
|
|
|
|
|
|
|
}; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Deploy. |
96
|
1
|
|
|
|
|
26
|
$engine->set_variables( $self->_collect_deploy_vars($target) ); |
97
|
12
|
|
|
|
|
222
|
$engine->deploy( $upto, $self->mode ); |
98
|
|
|
|
|
|
|
return $self; |
99
|
|
|
|
|
|
|
} |
100
|
9
|
|
|
|
|
193
|
|
101
|
9
|
|
|
|
|
150
|
1; |
102
|
9
|
|
|
|
|
92
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 Name |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
App::Sqitch::Command::rebase - Revert and redeploy Sqitch changes |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 Synopsis |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $cmd = App::Sqitch::Command::rebase->new(%params); |
111
|
|
|
|
|
|
|
$cmd->execute; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 Description |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
If you want to know how to use the C<rebase> command, you probably want to be |
116
|
|
|
|
|
|
|
reading C<sqitch-rebase>. But if you really want to know how the C<rebase> command |
117
|
|
|
|
|
|
|
works, read on. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 Interface |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 Class Methods |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head3 C<options> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
my @opts = App::Sqitch::Command::rebase->options; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Returns a list of L<Getopt::Long> option specifications for the command-line |
128
|
|
|
|
|
|
|
options for the C<rebase> command. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 Attributes |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head3 C<onto_change> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Change onto which to rebase the target. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head3 C<upto_change> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Change up to which to rebase the target. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head3 C<modified> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Boolean to revert to the change prior to earliest change with a revised |
143
|
|
|
|
|
|
|
deploy script. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 Instance Methods |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head3 C<execute> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
$rebase->execute; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Executes the rebase command. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 See Also |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item L<sqitch-rebase> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Documentation for the C<rebase> command to the Sqitch command-line client. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item L<sqitch> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The Sqitch command-line client. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=back |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 Author |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
David E. Wheeler <david@justatheory.com> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 License |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Copyright (c) 2012-2022 iovation Inc., David E. Wheeler |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
176
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
177
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
178
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
179
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
180
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all |
183
|
|
|
|
|
|
|
copies or substantial portions of the Software. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
186
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
187
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
188
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
189
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
190
|
|
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
191
|
|
|
|
|
|
|
SOFTWARE. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=cut |