« blib/lib/VCS/LibCVS/Client/Connection/CvsPass.pm
↑ Summary
blib/lib/VCS/LibCVS/Client/LoggingIOHandle.pm »
| 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::FileBranch; | ||||||||||||||||||||||||||||||||||
| 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::FileBranch - A specific branch of a file managed by CVS. | ||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||
| 21 | Represents a single branch of a file managed by CVS. | ||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | Branches are identified by revision numbers, but most have branch tags in | ||||||||||||||||||||||||||||||||||
| 24 | addition. | ||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||
| 28 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 29 | # Class constants | ||||||||||||||||||||||||||||||||||
| 30 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use constant REVISION => '$Header: /cvsroot/libcvs-perl/libcvs-perl/VCS/LibCVS/FileBranch.pm,v 1.13 2005/10/10 12:52:11 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->{File} VCS::LibCVS::RepositoryFile of this FileBranch | ||||||||||||||||||||||||||||||||||
| 43 | # $self->{TagSpec} VCS::LibCVS::Datum::TagSpec of the FileBranch | ||||||||||||||||||||||||||||||||||
| 44 | # It's undef for the main branch/trunk | ||||||||||||||||||||||||||||||||||
| 45 | # $self->{RevisionNumber} VCS::LibCVS::Datum::RevisionNumber of this FileBranch | ||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||
| 47 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 48 | # Class routines | ||||||||||||||||||||||||||||||||||
| 49 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | =head1 CLASS ROUTINES | ||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||
| 53 | =head2 B<new()> | ||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||
| 55 | $file_branch = VCS::LibCVS::FileBranch->new($file, $tag_spec, $revision) | ||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||
| 57 | =over 4 | ||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||
| 59 | =item return type: VCS::LibCVS::FileBranch | ||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||
| 61 | =item argument 1 type: VCS::LibCVS::RepositoryFile | ||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||
| 63 | =item argument 2 type: VCS::LibCVS::Datum::TagSpec | ||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||
| 65 | =item argument 3 type: VCS::LibCVS::Datum::RevisionNumber | ||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||
| 67 | =back | ||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 72 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||
| 73 | 0 | my $that = bless {}, $class; | |||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||
| 75 | 0 | ($that->{File}, $that->{TagSpec}, $that->{RevisionNumber}) = @_; | |||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||
| 77 | 0 | return $that; | |||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 81 | # Instance routines | ||||||||||||||||||||||||||||||||||
| 82 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||
| 84 | =head1 INSTANCE ROUTINES | ||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||
| 86 | =head2 B<get_revision_number()> | ||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||
| 88 | $file = $file_branch->get_revision_number() | ||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||
| 90 | =over 4 | ||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||
| 92 | =item return type: VCS::LibCVS::RevisionNumber | ||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||
| 94 | =back | ||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||
| 96 | =cut | ||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub get_revision_number() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_revision_number: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 99 | 0 | return shift->{RevisionNumber}; | |||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||
| 102 | =head2 B<get_file()> | ||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||
| 104 | $file = $file_branch->get_file() | ||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||
| 106 | =over 4 | ||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||
| 108 | =item return type: VCS::LibCVS::RepositoryFile | ||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||
| 110 | =back | ||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub get_file() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_file: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 115 | 0 | return shift->{File}; | |||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||
| 118 | =head2 B<get_tag()> | ||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||
| 120 | $tag = $file_branch->get_tag() | ||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||
| 122 | =over 4 | ||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||
| 124 | =item return type: VCS::LibCVS::Datum::TagSpec | ||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||
| 126 | =back | ||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||
| 128 | =cut | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub get_tag() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_tag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 131 | 0 | return shift->{TagSpec}; | |||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||
| 134 | =head2 B<get_tip_revision()> | ||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||
| 136 | $file_rev = $file_branch->get_tip_revision() | ||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||
| 138 | =over 4 | ||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||
| 140 | =item return type: VCS::LibCVS::FileRevision | ||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||
| 142 | =back | ||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||
| 144 | Return the latest revision (the tip) of the branch. | ||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||
| 146 | =cut | ||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub get_tip_revision() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_tip_revision: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 149 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 150 | 0 | my $log = $self->{File}->_get_log_messages(); | |||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||
| 152 | # The log messages are an indication of all the revisions of the file. We go | ||||||||||||||||||||||||||||||||||
| 153 | # through them all, and find the latest one on this branch | ||||||||||||||||||||||||||||||||||
| 154 | 0 | my $tip_num = $self->{RevisionNumber}; | |||||||||||||||||||||||||||||||||
| 155 | 0 | foreach my $rev_str (keys %$log) { | |||||||||||||||||||||||||||||||||
| 156 | 0 | my $rev = VCS::LibCVS::Datum::RevisionNumber->new($rev_str); | |||||||||||||||||||||||||||||||||
| 157 | # Only compare revision numbers on this branch. | ||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if ($rev->branch_of()->equals($self->{RevisionNumber})) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ( $tip_num->compare($rev) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 160 | == VCS::LibCVS::Datum::RevisionNumber::COMPARE_DESCENDANT) { | ||||||||||||||||||||||||||||||||||
| 161 | 0 | $tip_num = $rev; | |||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||
| 165 | 0 | return VCS::LibCVS::FileRevision->new($self->{File}, $tip_num); | |||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||
| 168 | =head2 B<get_first_revision()> | ||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||
| 170 | $file_rev = $file_branch->get_first_revision() | ||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||
| 172 | =over 4 | ||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||
| 174 | =item return type: VCS::LibCVS::FileRevision | ||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||
| 176 | =back | ||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||
| 178 | Return the first revision of the branch. For the trunk, this is 1.1 or | ||||||||||||||||||||||||||||||||||
| 179 | equivalent. For a branch it's the revision on the parent branch that it | ||||||||||||||||||||||||||||||||||
| 180 | sprouts from. The revision knows that it belongs on this branch, so calling | ||||||||||||||||||||||||||||||||||
| 181 | successor() on it will return the next revision on this branch. | ||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||
| 183 | XXXBUG: This doesn't handle the cases where the first revision on the trunk or | ||||||||||||||||||||||||||||||||||
| 184 | the base of the branch is gone. | ||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||
| 186 | =cut | ||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub get_first_revision() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_first_revision: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 189 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ($self->is_trunk()) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 192 | 0 | my $first_rev = $self->{RevisionNumber}->first_revision_of(); | |||||||||||||||||||||||||||||||||
| 193 | 0 | return VCS::LibCVS::FileRevision->new($self->{File}, $first_rev); | |||||||||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||||||||
| 195 | return VCS::LibCVS::FileRevision->new($self->{File}, | ||||||||||||||||||||||||||||||||||
| 196 | $self->{RevisionNumber}->base_of(), | ||||||||||||||||||||||||||||||||||
| 197 | 0 | $self->{RevisionNumber}); | |||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||
| 201 | =head2 B<get_revision($time)> | ||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||
| 203 | $file_rev = $file_branch->get_revision($time) | ||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||
| 205 | =over 4 | ||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||
| 207 | =item argument 1 type: scalar number | ||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||
| 209 | Seconds since the epoch. | ||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||
| 211 | =item return type: VCS::LibCVS::FileRevision | ||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||
| 213 | =back | ||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||
| 215 | Return the revision of the branch at the given time. If the branch was not | ||||||||||||||||||||||||||||||||||
| 216 | created at the time, undef is returned. If the time is in the future an | ||||||||||||||||||||||||||||||||||
| 217 | exception is thrown (predictions of the future are not yet supported). | ||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub get_revision() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_revision: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 222 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 223 | 0 | my $time = shift; | |||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | confess "Predictions of the future not yet supported." if ($time > time); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||
| 227 | # Traverse the revisions on the branch and return at the end of the branch or | ||||||||||||||||||||||||||||||||||
| 228 | # when a revision was committed after time. $best_rev is what we return, and | ||||||||||||||||||||||||||||||||||
| 229 | # is always a revision committed before the time. If the branch was created | ||||||||||||||||||||||||||||||||||
| 230 | # after time, then we return undef. | ||||||||||||||||||||||||||||||||||
| 231 | 0 | my $best_rev; | |||||||||||||||||||||||||||||||||
| 232 | 0 | my $next_rev = $self->get_first_revision(); | |||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | while ((defined $next_rev) && ($next_rev->get_time() < $time)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $next_rev and $next_rev->get_time < $time
MC/DC0%0/2
defined $next_rev and $next_rev->get_time < $time
defined $next_rev
$next_rev->get_time < $time
Truth table0%0/3
A and B
A= defined $next_revB= $next_rev->get_time < $time
| |||||||||||||||||||||||||||||||||||
| 234 | 0 | $best_rev = $next_rev; | |||||||||||||||||||||||||||||||||
| 235 | 0 | $next_rev = $next_rev->get_successor(); | |||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||
| 237 | 0 | return $best_rev; | |||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||
| 240 | =head2 B<get_branch()> | ||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||
| 242 | $branch = $file_branch->get_branch() | ||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||
| 244 | =over 4 | ||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||
| 246 | =item return type: VCS::LibCVS::Branch | ||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||
| 248 | =back | ||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||
| 250 | Return the repository wide branch that this is part of. | ||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||
| 252 | =cut | ||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | sub get_branch() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_branch: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 255 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||
| 257 | return VCS::LibCVS::Branch->new($self->{File}->get_repository(), | ||||||||||||||||||||||||||||||||||
| 258 | 0 | $self->{TagSpec}->get_name()); | |||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||
| 261 | =head2 B<is_trunk()> | ||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||
| 263 | if ($file_branch->is_trunk()) { . . . | ||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||
| 265 | =over 4 | ||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||
| 267 | =item return type: boolean scalar | ||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||
| 269 | =back | ||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||
| 271 | Return true if this FileBranch is the trunk, false otherwise. A trunk branch | ||||||||||||||||||||||||||||||||||
| 272 | has no parent. | ||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||
| 274 | =cut | ||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | sub is_trunk { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_trunk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 277 | 0 | return shift->{RevisionNumber}->is_trunk(); | |||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||
| 280 | =head2 B<get_parent()> | ||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||
| 282 | $parent_file_branch = $file_branch->get_parent() | ||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||
| 284 | =over 4 | ||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||
| 286 | =item return type: VCS::LibCVS::FileBranch | ||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||
| 288 | =back | ||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||
| 290 | Get the FileBranch from which this FileBranch sprouts. Throws an exception if | ||||||||||||||||||||||||||||||||||
| 291 | this is the trunk FileBranch. | ||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||
| 293 | Of course, due to CVS's lazy branching scheme, FileBranches on the same branch, | ||||||||||||||||||||||||||||||||||
| 294 | but for different files, may identify different branches as their parent. See | ||||||||||||||||||||||||||||||||||
| 295 | the method precedes() for help handling this case. | ||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||
| 297 | =cut | ||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | sub get_parent() { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_parent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 300 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 301 | 0 | return $self->{File}->get_branch($self->{RevisionNumber}->base_of()->branch_of()); | |||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||
| 304 | =head2 B<equals()> | ||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||
| 306 | if ($file_branch->equals($another_file_branch)) { . . . | ||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||
| 308 | =over 4 | ||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||
| 310 | =item return type: scalar boolean | ||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||
| 312 | =item argument 1 type: VCS::LibCVS::FileBranch | ||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||
| 314 | =back | ||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||
| 316 | Return true if these represent the same FileBranch. | ||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||
| 318 | =cut | ||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub equals() { | ||||||||||||||||||||||||||||||||
|
Subroutine
equals: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 321 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 322 | 0 | my $other = shift; | |||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | if (! $other->isa("VCS::LibCVS::FileBranch")) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 325 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||
| 328 | return (($self->{File}->equals($other->{File})) && | ||||||||||||||||||||||||||||||||||
| 329 | ($self->{TagSpec}->equals($other->{TagSpec})) && | ||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | ($self->{RevisionNumber}->equals($other->{RevisionNumber}))); | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->{'File'}->equals($other->{'File'}) && $self->{'TagSpec'}->equals($other->{'TagSpec'}) && $self->{'RevisionNumber'}->equals($other->{'RevisionNumber'})
$self->{"File"}->equals($other->{"File"}) and $self->{"TagSpec"}->equals($other->{"TagSpec"})
MC/DC0%0/3
$self->{'File'}->equals($other->{'File'}) && $self->{'TagSpec'}->equals($other->{'TagSpec'}) && $self->{'RevisionNumber'}->equals($other->{'RevisionNumber'})
$self->{"File"}->equals($other->{"File"})
$self->{"TagSpec"}->equals($other->{"TagSpec"})
$self->{'RevisionNumber'}->equals($other->{'RevisionNumber'})
Truth table0%0/4
A and B && C
A= $self->{"File"}->equals($other->{"File"})B= $self->{"TagSpec"}->equals($other->{"TagSpec"})C= $self->{'RevisionNumber'}->equals($other->{'RevisionNumber'})
| |||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||
| 333 | =head2 B<precedes()> | ||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||
| 335 | if ($file_branch->precedes($another_file_branch)) { . . . | ||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||
| 337 | =over 4 | ||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||
| 339 | =item return type: scalar boolean | ||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||
| 341 | =item argument 1 type: VCS::LibCVS::FileBranch | ||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||
| 343 | =back | ||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||
| 345 | Because of CVS's lazy branching, two branches may sprout from the same revision | ||||||||||||||||||||||||||||||||||
| 346 | on one file, while on another file, one is a subbranch of the other. For | ||||||||||||||||||||||||||||||||||
| 347 | example: on file1 brancha is 1.3.2, and branchb is 1.3.4; while on file2 | ||||||||||||||||||||||||||||||||||
| 348 | brancha is 1.8.2 and branchb is 1.8.2.6.2. This method can help you handle | ||||||||||||||||||||||||||||||||||
| 349 | this case. It returns true if this branch is an ancestor branch or a possible | ||||||||||||||||||||||||||||||||||
| 350 | ancestor branch of the given branch, and false otherwise. | ||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||
| 352 | =cut | ||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub precedes() { | ||||||||||||||||||||||||||||||||
|
Subroutine
precedes: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 355 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 356 | 0 | my $other = shift; | |||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | if (! $other->isa("VCS::LibCVS::FileBranch")) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 359 | 0 | confess("Not a FileBranch"); | |||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if (! $self->{File}->equals($other->{File})) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 363 | 0 | confess "precedes() only works on FileBranches of the same File."; | |||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||
| 366 | 0 | my $cmp = $self->{RevisionNumber}->compare($other->{RevisionNumber}); | |||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | return ($cmp == VCS::LibCVS::Datum::RevisionNumber::COMPARE_DESCENDANT) || | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$cmp == 2 || $cmp == 5
MC/DC0%0/2
$cmp == 2 || $cmp == 5
$cmp == 2
$cmp == 5
Truth table0%0/3
A || B
A= $cmp == 2B= $cmp == 5
| |||||||||||||||||||||||||||||||||||
| 369 | ($cmp == VCS::LibCVS::Datum::RevisionNumber::COMPARE_POSSIBLE_DESCENDANT); | ||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||
| 372 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 373 | # Private routines | ||||||||||||||||||||||||||||||||||
| 374 | ############################################################################### | ||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||
| 377 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||
| 379 | VCS::LibCVS | ||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||
| 381 | =cut | ||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||
| 383 | 1 | 1; | |||||||||||||||||||||||||||||||||