| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
|
3
|
3
|
|
|
3
|
|
1421
|
use strict; |
|
|
3
|
|
|
|
|
10
|
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
81
|
|
|
5
|
3
|
|
|
3
|
|
13
|
use utf8; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
98
|
|
|
6
|
3
|
|
|
3
|
|
18
|
use Locale::TextDomain qw(App-Sqitch); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
17
|
|
|
7
|
3
|
|
|
3
|
|
92
|
use App::Sqitch::X qw(hurl); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
32
|
|
|
8
|
3
|
|
|
3
|
|
605
|
use List::Util qw(first); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
48
|
|
|
9
|
3
|
|
|
3
|
|
970
|
use Moo; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
214
|
|
|
10
|
3
|
|
|
3
|
|
20
|
use App::Sqitch::Types qw(Bool Str); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
21
|
|
|
11
|
3
|
|
|
3
|
|
1177
|
|
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
|
|
extends 'App::Sqitch::Command'; |
|
13
|
|
|
|
|
|
|
with 'App::Sqitch::Role::ContextCommand'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = 'v1.3.1'; # VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has target => ( |
|
18
|
|
|
|
|
|
|
is => 'ro', |
|
19
|
|
|
|
|
|
|
isa => Str, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has exists_only => ( |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
isa => Bool, |
|
25
|
|
|
|
|
|
|
default => 0, |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return qw( |
|
29
|
|
|
|
|
|
|
target|t=s |
|
30
|
|
|
|
|
|
|
exists|e! |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my ( $class, $config, $opt ) = @_; |
|
35
|
|
|
|
|
|
|
$opt->{exists_only} = delete $opt->{exists} |
|
36
|
|
|
|
|
|
|
if exists $opt->{exists}; |
|
37
|
|
|
|
|
|
|
return $class->SUPER::configure( $config, $opt ); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my ( $self, $type, $key ) = @_; |
|
41
|
|
|
|
|
|
|
$self->usage unless $type && $key; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
require App::Sqitch::Target; |
|
44
|
22
|
|
|
22
|
1
|
24139
|
my $target = $self->target ? App::Sqitch::Target->new( |
|
45
|
22
|
100
|
66
|
|
|
89
|
$self->target_params, |
|
46
|
|
|
|
|
|
|
name => $self->target, |
|
47
|
21
|
|
|
|
|
98
|
) : $self->default_target; |
|
48
|
21
|
100
|
|
|
|
416
|
my $plan = $target->plan; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Handle tags first. |
|
51
|
|
|
|
|
|
|
if ( $type eq 'tag' ) { |
|
52
|
21
|
|
|
|
|
556
|
my $is_id = $key =~ /^[0-9a-f]{40}/; |
|
53
|
|
|
|
|
|
|
my $change = $plan->get( |
|
54
|
|
|
|
|
|
|
$is_id ? $key : ($key =~ /^@/ ? '' : '@') . $key |
|
55
|
21
|
100
|
|
|
|
343
|
); |
|
56
|
7
|
|
|
|
|
19
|
|
|
57
|
7
|
100
|
|
|
|
34
|
my $tag = $change ? do { |
|
|
|
100
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
if ($is_id) { |
|
59
|
|
|
|
|
|
|
# It's a tag ID. |
|
60
|
|
|
|
|
|
|
first { $_->id eq $key } $change->tags; |
|
61
|
7
|
100
|
|
|
|
24
|
} else { |
|
62
|
4
|
100
|
|
|
|
11
|
# Tag name. |
|
63
|
|
|
|
|
|
|
(my $name = $key) =~ s/^[@]//; |
|
64
|
2
|
|
|
2
|
|
12
|
first { $_->name eq $name } $change->tags; |
|
|
2
|
|
|
|
|
40
|
|
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
} : undef; |
|
67
|
2
|
|
|
|
|
15
|
unless ($tag) { |
|
68
|
2
|
|
|
2
|
|
12
|
return if $self->exists_only; |
|
|
2
|
|
|
|
|
38
|
|
|
69
|
|
|
|
|
|
|
hurl show => __x( 'Unknown tag "{tag}"', tag => $key ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
7
|
100
|
|
|
|
29
|
$self->emit( $tag->info ) unless $self->exists_only; |
|
72
|
3
|
100
|
|
|
|
19
|
return $self; |
|
73
|
2
|
|
|
|
|
8
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
4
|
100
|
|
|
|
48
|
# Make sure we recognize the type. |
|
76
|
4
|
|
|
|
|
138
|
hurl show => __x( |
|
77
|
|
|
|
|
|
|
'Unknown object type "{type}', |
|
78
|
|
|
|
|
|
|
type => $type, |
|
79
|
|
|
|
|
|
|
) unless first { $type eq $_ } qw(change deploy revert verify); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Make sure we have a change object. |
|
82
|
|
|
|
|
|
|
my $change = $plan->get($key) or do { |
|
83
|
14
|
100
|
|
27
|
|
71
|
return if $self->exists_only; |
|
|
27
|
|
|
|
|
53
|
|
|
84
|
|
|
|
|
|
|
hurl show => __x( |
|
85
|
|
|
|
|
|
|
'Unknown change "{change}"', |
|
86
|
13
|
100
|
|
|
|
56
|
change => $key |
|
87
|
2
|
100
|
|
|
|
17
|
); |
|
88
|
1
|
|
|
|
|
4
|
}; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
if ($type eq 'change') { |
|
91
|
|
|
|
|
|
|
# Just show its info. |
|
92
|
|
|
|
|
|
|
$self->emit( $change->info ) unless $self->exists_only; |
|
93
|
|
|
|
|
|
|
return $self; |
|
94
|
11
|
100
|
|
|
|
20
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
6
|
100
|
|
|
|
98
|
my $meth = $change->can("$type\_file"); |
|
97
|
6
|
|
|
|
|
293
|
my $path = $change->$meth; |
|
98
|
|
|
|
|
|
|
unless (-e $path) { |
|
99
|
|
|
|
|
|
|
return if $self->exists_only; |
|
100
|
5
|
|
|
|
|
24
|
hurl show => __x('File "{path}" does not exist', path => $path); |
|
101
|
5
|
|
|
|
|
19
|
} |
|
102
|
5
|
100
|
|
|
|
367
|
hurl show => __x('"{path}" is not a file', path => $path) |
|
103
|
2
|
100
|
|
|
|
102
|
if $path->is_dir; |
|
104
|
1
|
|
|
|
|
7
|
|
|
105
|
|
|
|
|
|
|
return $self if $self->exists_only; |
|
106
|
3
|
50
|
|
|
|
142
|
|
|
107
|
|
|
|
|
|
|
# Assume nothing about the encoding. |
|
108
|
|
|
|
|
|
|
binmode STDOUT, ':raw'; |
|
109
|
3
|
100
|
|
|
|
24
|
$self->emit( $path->slurp(iomode => '<:raw') ); |
|
110
|
|
|
|
|
|
|
return $self; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
2
|
|
|
|
|
9
|
|
|
113
|
2
|
|
|
|
|
6
|
1; |
|
114
|
2
|
|
|
|
|
816
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 Name |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
App::Sqitch::Command::show - Show Sqitch changes to a database |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 Synopsis |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $cmd = App::Sqitch::Command::show->new(%params); |
|
123
|
|
|
|
|
|
|
$cmd->execute($type, $name); |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 Description |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Shows the content of a Sqitch object. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
If you want to know how to use the C<show> command, you probably want to be |
|
130
|
|
|
|
|
|
|
reading C<sqitch-show>. But if you really want to know how the C<show> command |
|
131
|
|
|
|
|
|
|
works, read on. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 Interface |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 Class Methods |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head3 C<options> |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my @opts = App::Sqitch::Command::show->options; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Returns a list of L<Getopt::Long> option specifications for the command-line |
|
142
|
|
|
|
|
|
|
options for the C<show> command. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 Attributes |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head3 C<exists_only> |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Boolean indicating whether or not to suppress output and instead exit with |
|
149
|
|
|
|
|
|
|
zero status if object exists and is a valid object. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 Instance Methods |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head3 C<execute> |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$show->execute; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Executes the show command. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 See Also |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=over |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item L<sqitch-show> |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Documentation for the C<show> command to the Sqitch command-line client. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item L<sqitch> |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
The Sqitch command-line client. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=back |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 Author |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
David E. Wheeler <david@justatheory.com> |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 License |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Copyright (c) 2012-2022 iovation Inc., David E. Wheeler |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
182
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
|
183
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
|
184
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
185
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
|
186
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all |
|
189
|
|
|
|
|
|
|
copies or substantial portions of the Software. |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
192
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
193
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
194
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
195
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
196
|
|
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
197
|
|
|
|
|
|
|
SOFTWARE. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |