| 1 | # | ||||||||||||||||||||||||||||
| 2 | # Copyright (c) 2003,2004,2005 Alexander Taler (dissent@0--0.org) | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # All rights reserved. This program is free software; you can redistribute it | ||||||||||||||||||||||||||||
| 5 | # and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | package VCS::LibCVS::Command; | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | VCS::LibCVS::Command - A command to send to the server. | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | VCS::LibCVS::Command represents a single command sent to the server, and | ||||||||||||||||||||||||||||
| 22 | provides access to the response. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | It is for internal LibCVS use only. | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | ############################################################################### | ||||||||||||||||||||||||||||
| 29 | # Class constants | ||||||||||||||||||||||||||||
| 30 | ############################################################################### | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use constant REVISION => '$Header: /cvsroot/libcvs-perl/libcvs-perl/VCS/LibCVS/Command.pm,v 1.15 2005/10/10 12:19:18 dissent Exp $ '; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | ############################################################################### | ||||||||||||||||||||||||||||
| 35 | # Class variables | ||||||||||||||||||||||||||||
| 36 | ############################################################################### | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | ############################################################################### | ||||||||||||||||||||||||||||
| 39 | # Private variables | ||||||||||||||||||||||||||||
| 40 | ############################################################################### | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | # $self->{Options} Hash ref of options with which the command was created. | ||||||||||||||||||||||||||||
| 43 | # $self->{AURequest} VCS::LibCVS::Client::Request::ArgumentUsingRequest | ||||||||||||||||||||||||||||
| 44 | # $self->{CVSOptions} List ref of VCS::LibCVS::Client::Request::Argument | ||||||||||||||||||||||||||||
| 45 | # $self->{Files} List ref of VCS::LibCVS::[Working]FileOrDirectory | ||||||||||||||||||||||||||||
| 46 | # $self->{Responses} List ref of VCS::LibCVS::Client::Response | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | ############################################################################### | ||||||||||||||||||||||||||||
| 49 | # Class routines | ||||||||||||||||||||||||||||
| 50 | ############################################################################### | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head1 CLASS ROUTINES | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head2 B<new()> | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | $command = VCS::LibCVS::Command->new($opts, $command, $opts, $files_and_dirs) | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =over 4 | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =item return type: VCS::LibCVS::Command | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | Newly created command class. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =item argument 1 type: ref to hash of options | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | No options currently supported. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =item argument 2 type: scalar string | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | The CVS command to call, such as "update", "ci", etc. Strictly, it is the | ||||||||||||||||||||||||||||
| 71 | name of one of the subclasses of | ||||||||||||||||||||||||||||
| 72 | VCS::LibCVS::Client::Request::ArgumentUsingRequest. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =item argument 3 type: ref to list of scalar strings | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | Options to pass to the CVS server, such as "-r1.1", "-kb". These are pretty | ||||||||||||||||||||||||||||
| 77 | much the same as the options passed on the cvs command line. | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =item argument 4 type: ref to list of files and directories | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | The files and directories to process for the command. They are objects of any | ||||||||||||||||||||||||||||
| 82 | of these types: | ||||||||||||||||||||||||||||
| 83 | VCS::LibCVS::RepositoryFile | ||||||||||||||||||||||||||||
| 84 | VCS::LibCVS::RepositoryDirectory | ||||||||||||||||||||||||||||
| 85 | VCS::LibCVS::WorkingFile | ||||||||||||||||||||||||||||
| 86 | VCS::LibCVS::WorkingDirectory | ||||||||||||||||||||||||||||
| 87 | VCS::LibCVS::FileRevision | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =back | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | Creates a new Command. You must then issue the command on a repository. | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =cut | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 97 | 0 | my $that = bless {}, $class; | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | $that->{Options} = shift; | |||||||||||||||||||||||||||
| 100 | 0 | my $aurequest_class_name = "VCS::LibCVS::Client::Request::" . shift; | |||||||||||||||||||||||||||
| 101 | 0 | $that->{AURequest} = "$aurequest_class_name"->new(); | |||||||||||||||||||||||||||
| 102 | $that->{CVSOptions} = | ||||||||||||||||||||||||||||
| 103 | 0 | [ map({ VCS::LibCVS::Client::Request::Argument->new($_); } @{shift()}) ]; | |||||||||||||||||||||||||||
| 104 | 0 | $that->{Files} = shift; | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | return $that; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | ############################################################################### | ||||||||||||||||||||||||||||
| 110 | # Instance routines | ||||||||||||||||||||||||||||
| 111 | ############################################################################### | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =head1 INSTANCE ROUTINES | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =head2 B<issue()> | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | $command->issue($repo) | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =over 4 | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | =item return type: undef | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | =item argument 1 type: VCS::LibCVS::Repository | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | The repository upon which the command is issued. | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | =back | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | Issues the command on the repository. In case of error an exception is | ||||||||||||||||||||||||||||
| 130 | thrown. | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | To get the reponses, use get_responses() or get_messages(). | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =cut | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | # From the cvs protocol docs: | ||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||
| 138 | # normal usage is to send `Directory' for | ||||||||||||||||||||||||||||
| 139 | # each directory in which there will be an `Entry' or `Modified', | ||||||||||||||||||||||||||||
| 140 | # and then a final `Directory' for the original directory, then the | ||||||||||||||||||||||||||||
| 141 | # command. | ||||||||||||||||||||||||||||
| 142 | # | ||||||||||||||||||||||||||||
| 143 | # 'Entry' and 'Modified' are requests. I have also found it necessary to send | ||||||||||||||||||||||||||||
| 144 | # a 'Directory' for each directory in which an argument request appears. The | ||||||||||||||||||||||||||||
| 145 | # following works for a subdirectory: | ||||||||||||||||||||||||||||
| 146 | # Argument "testdir1/subdir1" | ||||||||||||||||||||||||||||
| 147 | # Directory ["testdir1/subdir1", "$rep_dir/testdir1/subdir1"] | ||||||||||||||||||||||||||||
| 148 | # Directory [".", "$rep_dir"] | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub issue { | ||||||||||||||||||||||||||
|
Subroutine
issue: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||
| 151 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 152 | 0 | my $repo = shift; | |||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | ### Open the connection to the server | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | # Get a client object for the repository. _get_client() requires the name | ||||||||||||||||||||||||||||
| 157 | # of a server directory, which is fetched from a FileOrDirectory object | ||||||||||||||||||||||||||||
| 158 | # found in {Files}. | ||||||||||||||||||||||||||||
| 159 | 0 | my $client; | |||||||||||||||||||||||||||
| 160 | { | ||||||||||||||||||||||||||||
| 161 | 0 | my $f = $self->{Files}->[0]; | |||||||||||||||||||||||||||
| 162 | 0 | ▶ | if ($f->isa("VCS::LibCVS::FileRevision")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 0 | $f = $f->get_file(); | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | 0 | $client = $repo->_get_client($f->_get_repo_dirs()->[1]); | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | ### Send CVS options | ||||||||||||||||||||||||||||
| 169 | 0 | foreach my $opt (@{$self->{CVSOptions}}) { | |||||||||||||||||||||||||||
| 170 | 0 | $client->submit_request($opt); | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | ### Send filename and directory args | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | # Each consists of an Argument request, followed by a matching Directory | ||||||||||||||||||||||||||||
| 176 | # request. It all ends with a final Directory request for the "original | ||||||||||||||||||||||||||||
| 177 | # directory", presumably the current working directory. I assume that all | ||||||||||||||||||||||||||||
| 178 | # files are named relative to this. | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | # All of the file and directory objects implement the _get_repo_dirs() | ||||||||||||||||||||||||||||
| 181 | # routine, to get the information for generating a Directory request to send | ||||||||||||||||||||||||||||
| 182 | # to the server. The routine returns a ref to a list containing two scalars, | ||||||||||||||||||||||||||||
| 183 | # the working directory and repository directory, as needed for the Directory | ||||||||||||||||||||||||||||
| 184 | # request. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | # %dirs_sent keeps track of the Directory requests that have been sent to the | ||||||||||||||||||||||||||||
| 187 | # server | ||||||||||||||||||||||||||||
| 188 | 0 | my %dirs_sent; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 0 | foreach my $f (@{$self->{Files}}) { | |||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ( $f->isa("VCS::LibCVS::WorkingDirectory") ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | confess "WorkingDirectory not supported. See bug #14191."; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | # Make sure that $f is a FileOrDirectory object, but keep any FileRevision | ||||||||||||||||||||||||||||
| 197 | # object in order to generate an Entries line later. | ||||||||||||||||||||||||||||
| 198 | 0 | my $fr; | |||||||||||||||||||||||||||
| 199 | 0 | ▶ | if ($f->isa("VCS::LibCVS::FileRevision")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | $fr = $f; | |||||||||||||||||||||||||||
| 201 | 0 | $f = $fr->get_file(); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | my $fnreq = VCS::LibCVS::Client::Request::Argument->new([$f->get_name]); | |||||||||||||||||||||||||||
| 205 | 0 | $client->submit_request($fnreq); | |||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | # Save bandwidth by only sending directory requests once | ||||||||||||||||||||||||||||
| 208 | 0 | my $dirs = $f->_get_repo_dirs; | |||||||||||||||||||||||||||
| 209 | 0 | ▶ | if (!$dirs_sent{$dirs->[0]}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 0 | $dirs_sent{$dirs->[0]} = $dirs->[1]; | |||||||||||||||||||||||||||
| 211 | 0 | my $dreq = VCS::LibCVS::Client::Request::Directory->new($dirs); | |||||||||||||||||||||||||||
| 212 | 0 | $client->submit_request($dreq); | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | # For some requests ( such as "ci" and "diff" ) the server needs | ||||||||||||||||||||||||||||
| 216 | # information about the local state of the files in the form of Entries | ||||||||||||||||||||||||||||
| 217 | # lines and the file contents. This information is only sent if the | ||||||||||||||||||||||||||||
| 218 | # Request object indicates that it is needed. Some Requests, notably | ||||||||||||||||||||||||||||
| 219 | # update, use file contents and entry requests, but don't require them. | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | ▶ | if ($self->{AURequest}->uses_file_entry()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | 0 | my $e; | |||||||||||||||||||||||||||
| 223 | 0 | ▶ | if (defined $fr) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 224 | # A FileRevision is being processed so get the entry from there. | ||||||||||||||||||||||||||||
| 225 | 0 | $e = $fr->_get_entry(); | |||||||||||||||||||||||||||
| 226 | } elsif ( $f->isa("VCS::LibCVS::WorkingFile") ) { | ||||||||||||||||||||||||||||
| 227 | 0 | $e = $f->_get_entry(); | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if (defined $e) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | 0 | $client->submit_request(VCS::LibCVS::Client::Request::Entry->new([$e])); | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if ($self->{AURequest}->uses_file_contents() | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"AURequest"}->uses_file_contents and $f->isa("VCS::LibCVS::WorkingFile")
MC/DC0%0/2
$self->{"AURequest"}->uses_file_contents and $f->isa("VCS::LibCVS::WorkingFile")
$self->{"AURequest"}->uses_file_contents
$f->isa("VCS::LibCVS::WorkingFile")
Truth table0%0/3
A and B
A= $self->{"AURequest"}->uses_file_contentsB= $f->isa("VCS::LibCVS::WorkingFile")
| |||||||||||||||||||||||||||||
| 235 | && $f->isa("VCS::LibCVS::WorkingFile")) { | ||||||||||||||||||||||||||||
| 236 | 0 | my $m = [$f->get_name({no_dir => 1}), $f->_get_mode, $f->_get_contents]; | |||||||||||||||||||||||||||
| 237 | 0 | my $m_req = (VCS::LibCVS::Client::Request::Modified->new( $m )); | |||||||||||||||||||||||||||
| 238 | 0 | $client->submit_request($m_req); | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | # Send the original directory request | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | # This could be the current directory, or the common ancestor of all the sent | ||||||||||||||||||||||||||||
| 245 | # directories. We use the root directory. | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | # If it's already been sent with one of the previous arguments, just resend | ||||||||||||||||||||||||||||
| 248 | # that one. If it wasn't already sent, we should look in the /CVS Admin | ||||||||||||||||||||||||||||
| 249 | # directory to get the repository for the current directory. But that | ||||||||||||||||||||||||||||
| 250 | # doesn't match our paradigm very well, and it doesn't really matter, because | ||||||||||||||||||||||||||||
| 251 | # we know that none of the files we are interested in live in the current | ||||||||||||||||||||||||||||
| 252 | # directory. So, we just send the cwd (".") and the repository root. | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | ▶ | my $r_dir = $dirs_sent{"."} || $repo->get_root()->get_dir(); | ||||||||||||||||||||||||||
|
Condition0%0/3
$dirs_sent{'.'} || $repo->get_root->get_dir
MC/DC0%0/2
$dirs_sent{'.'} || $repo->get_root->get_dir
$dirs_sent{'.'}
$repo->get_root->get_dir
Truth table0%0/3
A || B
A= $dirs_sent{'.'}B= $repo->get_root->get_dir
| |||||||||||||||||||||||||||||
| 255 | 0 | my $origd_req = VCS::LibCVS::Client::Request::Directory->new([".","$r_dir"]); | |||||||||||||||||||||||||||
| 256 | 0 | $client->submit_request($origd_req); | |||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | ### Send the command request | ||||||||||||||||||||||||||||
| 259 | 0 | my @resps = $client->submit_request($self->{AURequest}); | |||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | ### Check responses | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | # Throw an exception in case of error | ||||||||||||||||||||||||||||
| 264 | 0 | ▶ | if (($resps[-1]->isa("VCS::LibCVS::Client::Response::error"))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | 0 | my $errors; | |||||||||||||||||||||||||||
| 266 | 0 | ▶ | foreach my $resp (@resps) { $errors .= ($resp->get_errors() || ""); }; | ||||||||||||||||||||||||||
|
Condition0%0/2
$resp->get_errors || ''
MC/DC0%0/1
$resp->get_errors || ''
$resp->get_errors
Truth table0%0/2
A
A= $resp->get_errors
| |||||||||||||||||||||||||||||
| 267 | 0 | confess "Request failed: \"$errors\""; | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | # No error, so just store the responses and return. | ||||||||||||||||||||||||||||
| 271 | 0 | $self->{Responses} = \@resps; | |||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 0 | return; | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =head2 B<get_responses()> | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | @responses = $command->get_responses($type) | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =over 4 | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =item return type: list of VCS::LibCVS::Client::Response | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =item argument 1 type: scalar type string | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | The type of responses requested. | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =back | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | Returns the responses of the specified type. If the type is undef or the empty | ||||||||||||||||||||||||||||
| 291 | string, all responses are returned. | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | =cut | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | 0 | ▶ | sub get_responses { | ||||||||||||||||||||||||||
|
Subroutine
get_responses: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 296 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 297 | 0 | ▶ | my $c = shift || "VCS::LibCVS::Client::Response"; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'VCS::LibCVS::Client::Response'
MC/DC0%0/1
shift() || 'VCS::LibCVS::Client::Response'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 0 | ▶ | return map { $_->isa($c) ? $_ : () } @{ $self->{Responses} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | =head2 B<get_messages()> | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | @messages = $command->get_messages($pattern) | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =over 4 | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | =item return type: list of scalar strings | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | =item argument 1 type: scalar string or Regexp | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | Optional Regexp that returned messages match. | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | =back | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | Goes through all the M reponses and returns the contents of those which match | ||||||||||||||||||||||||||||
| 317 | the provided regexp. | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | =cut | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | 0 | ▶ | sub get_messages { | ||||||||||||||||||||||||||
|
Subroutine
get_messages: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 322 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 323 | 0 | ▶ | my $p = shift || "^"; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || '^'
MC/DC0%0/1
shift() || '^'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | return map { | ||||||||||||||||||||||||||||
| 326 | 0 | ▶ | ($_->get_message() =~ /$p/) ? $_->get_message : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 327 | } $self->get_responses("VCS::LibCVS::Client::Response::M"); | ||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =head2 B<get_errors()> | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | @messages = $command->get_errors($pattern) | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =over 4 | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | =item return type: list of scalar strings | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | =item argument 1 type: scalar string or Regexp | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | Optional Regexp that returned errors match. | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | =back | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | Goes through all the E reponses and returns the contents of those which match | ||||||||||||||||||||||||||||
| 345 | the provided regexp. | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | =cut | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | 0 | ▶ | sub get_errors { | ||||||||||||||||||||||||||
|
Subroutine
get_errors: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 350 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 351 | 0 | ▶ | my $p = shift || "^"; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || '^'
MC/DC0%0/1
shift() || '^'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | return map { | ||||||||||||||||||||||||||||
| 354 | 0 | ▶ | ($_->get_errors() =~ /$p/) ? $_->get_errors : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 355 | } $self->get_responses("VCS::LibCVS::Client::Response::E"); | ||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | =head2 B<get_files()> | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | @files = $command->get_files() | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =over 4 | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | =item return type: list of VCS::LibCVS::Client::Response | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | =back | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | Goes through all the reponses and returns those which are file transmissions. | ||||||||||||||||||||||||||||
| 369 | They are responses of type "Checked-in", "Merged", "Updated", . . . | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub get_files { | ||||||||||||||||||||||||||
|
Subroutine
get_files: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 374 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | return map { | ||||||||||||||||||||||||||||
| 377 | 0 | $self->get_responses("VCS::LibCVS::Client::Response::" . $_ ); | |||||||||||||||||||||||||||
| 378 | } ("Checked_in", "Merged", "Updated"); | ||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | ############################################################################### | ||||||||||||||||||||||||||||
| 382 | # Private routines | ||||||||||||||||||||||||||||
| 383 | ############################################################################### | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | VCS::LibCVS | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 1 | 1; | |||||||||||||||||||||||||||