| 1 | package ClearCase::SyncTree; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $VERSION = '0.60'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | require 5.004; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use File::Compare; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use File::Copy; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use File::Spec 0.82; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use ClearCase::Argv 1.34 qw(chdir); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use constant MSWIN => $^O =~ /MSWin|Windows_NT/i ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use constant CYGWIN => $^O =~ /cygwin/i ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | my $lext = '.=lnk='; # special extension for pseudo-symlinks | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my $class; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($class = ref($proto)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | # Make a (deep) clone of the invoking instance | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | require Clone; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | Clone->VERSION(0.12); # 0.10 has a known bug | |||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | return Clone::clone($proto); | |||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $class = $proto; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $self = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $self->comment('By:' . __PACKAGE__); | |||||||||||||||||||||||||||||||||||||||||
| 36 | # Default is to sync file modes unless on ^$%#* Windows. | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $self->protect(1); | |||||||||||||||||||||||||||||||||||||||||
| 38 | # Set up a ClearCase::Argv instance with the appropriate attrs. | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $self->ct; | |||||||||||||||||||||||||||||||||||||||||
| 40 | # By default we'll call SyncTree->fail on any cleartool error. | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->err_handler($self, 'fail'); | |||||||||||||||||||||||||||||||||||||||||
| 42 | # Set default file comparator. | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $self->cmp_func(\&File::Compare::compare); | |||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub err_handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
err_handler: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $ct = $self->ct; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if (@_ >= 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my($obj, $method) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $method = join('::', ref($obj), $method) unless $method =~ /::/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $ct->autofail([\&$method, $obj]); | |||||||||||||||||||||||||||||||||||||||||
| 54 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $ct->autofail(@_); | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | # For internal use only. Provides a std msg format. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub _msg { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_msg: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $prog = basename($0); | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $msg = "@_"; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | chomp $msg; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return "$prog: $type: $msg\n"; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | # For internal use only. A synonym for die() with a std error msg format. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub fatal { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fatal: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | die _msg('Error', @_); | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | # For internal use only. A synonym for warn() with a std error msg format. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub warning { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warning: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | warn _msg('Warning', @_); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | # For internal use only. Returns the ClearCase::Argv object. | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub ct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ct: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | return $self->{ST_CT} if $self->{ST_CT}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if (!defined(wantarray)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $ct = ClearCase::Argv->new({autochomp=>1, outpathnorm=>1}); | |||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $ct->syxargs($ct->qxargs); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->{ST_CT} = $ct; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return $self->{ST_CT}; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | # For internal use only. Returns a clone of the ClearCase::Argv object. | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | sub clone_ct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone_ct: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $ct = $self->ct->clone(@_); | |||||||||||||||||||||||||||||||||||||||||
| 94 | my $af = $self->ct->autofail | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | unless $_[0] and (ref($_[0]) eq 'HASH') and exists $_[0]->{autofail}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$_[0] and ref $_[0] eq "HASH" and exists $_[0]{"autofail"}
$_[0] and ref $_[0] eq "HASH"
MC/DC0%0/3
$_[0] and ref $_[0] eq "HASH" and exists $_[0]{"autofail"}
$_[0]
ref $_[0] eq "HASH"
exists $_[0]{"autofail"}
Truth table0%0/4
A and B and C
A= $_[0]B= ref $_[0] eq "HASH"C= exists $_[0]{"autofail"}
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $ct->autofail($af) if $af && ref($af); #Cloning doesn't share the value | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$af and ref $af
MC/DC0%0/2
$af and ref $af
$af
ref $af
Truth table0%0/3
A and B
A= $afB= ref $af
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $ct; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | sub gen_accessors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_accessors: called CC=2 SCAR=7.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | my @key = map {uc} @_; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | for (@key) { | |||||||||||||||||||||||||||||||||||||||||
| 104 | 14 | my $var = "ST_$_"; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 14 | my $meth = lc; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | *$meth = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $self->{$var} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | return $self->{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 14 | } | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | gen_accessors(qw(protect remove reuse vreuse lblver ignore_co overwrite_co | |||||||||||||||||||||||||||||||||||||||||
| 114 | snapdest ctime lbtype inclb cmp_func rellinks dstview)); | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | sub gen_flags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_flags: called CC=2 SCAR=8.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | my @key = map {uc} @_; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | for (@key) { | |||||||||||||||||||||||||||||||||||||||||
| 119 | 3 | my $var = "ST_$_"; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | my $meth = lc; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | *$meth = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | $self->{$var} = 1 if $_[0] || !defined(wantarray); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0] or not defined wantarray
MC/DC0%0/2
$_[0] or not defined wantarray
$_[0]
not defined wantarray
Truth table0%0/3
A or not(B)
A= $_[0]B= not defined wantarray
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return $self->{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 3 | } | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | gen_flags(qw(label_mods no_cr no_cmp)); | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub comment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my $cmnt = shift; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if (ref $cmnt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $self->{ST_COMMENT} = $cmnt; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } elsif ($cmnt) { | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{ST_COMMENT} = ['-c', $cmnt]; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return $self->{ST_COMMENT}; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub normalize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | chomp(my $path = shift); | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $dv = $self->dstview; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $md = $self->mvfsdrive if MSWIN; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | for ($path) { | |||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | if (MSWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 148 | s%^$md:%%; | ||||||||||||||||||||||||||||||||||||||||||
| 149 | s%^[\\/]\Q$dv%%; | ||||||||||||||||||||||||||||||||||||||||||
| 150 | s%\\%/%g; | ||||||||||||||||||||||||||||||||||||||||||
| 151 | $_ = "$md:/$dv$_"; | ||||||||||||||||||||||||||||||||||||||||||
| 152 | } elsif (CYGWIN) { | ||||||||||||||||||||||||||||||||||||||||||
| 153 | # 4 cases: unc; /view/x user mount; view drive; mvfs drive/tag | ||||||||||||||||||||||||||||||||||||||||||
| 154 | s%^/(/?view/$dv|cygdrive/\w(/$dv)?)%%; | ||||||||||||||||||||||||||||||||||||||||||
| 155 | $_ = "//view/$dv$_"; | ||||||||||||||||||||||||||||||||||||||||||
| 156 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | s%^/view/$dv%%; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $_ = "/view/$dv$_"; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | s%/\.?$%%; | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return $path; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub canonicalize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonicalize: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $base = shift; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | for (@_) { | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | $_ = File::Spec->canonpath(join('/', $base, $_)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ and not "File::Spec"->file_name_is_absolute($_)
MC/DC0%0/2
$_ and not "File::Spec"->file_name_is_absolute($_)
$_
not "File::Spec"->file_name_is_absolute($_)
Truth table0%0/3
A and not(B)
A= $_B= not "File::Spec"->file_name_is_absolute($_)
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | if $_ && ! File::Spec->file_name_is_absolute($_); | ||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | # Returns -other and -do private files. Checkouts are handled separately. | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub _lsprivate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lsprivate: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my $implicit_dirs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $base = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $dv = $self->dstview; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my $ct = $self->clone_ct({autofail=>0, stderr=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my @vp; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | for ($ct->argv('lsp', [qw(-oth -do -s -inv), "$base/.", '-tag', $dv])->qx) { | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $_ = $self->normalize($_); | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | push(@vp, $_) if m%^\Q$base/%; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | push(@vp, grep {$ct->des([qw(-s)], "$_/.\@\@")->stdout(0)->system} | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | @{$self->{ST_IMPLICIT_DIRS}}) | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if $self->{ST_IMPLICIT_DIRS} && $implicit_dirs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"ST_IMPLICIT_DIRS"} and $implicit_dirs
MC/DC0%0/2
$self->{"ST_IMPLICIT_DIRS"} and $implicit_dirs
$self->{"ST_IMPLICIT_DIRS"}
$implicit_dirs
Truth table0%0/3
A and B
A= $self->{"ST_IMPLICIT_DIRS"}B= $implicit_dirs
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return @vp; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub _lsco { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lsco: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $base = $self->_mkbase; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $ct = $self->clone_ct; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $sil = $self->clone_ct(stderr=>0, autofail=>0); | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my %co; | |||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | for ($ct->lsco([qw(-s -cvi -a)], $base)->qx) { | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $_ = $self->normalize($_); | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $co{$_}++ if m%^\Q$base/% || $_ eq $base; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
m[^\Q$base/\E] or $_ eq $base
MC/DC0%0/2
m[^\Q$base/\E] or $_ eq $base
m[^\Q$base/\E]
$_ eq $base
Truth table0%0/3
A or B
A= m[^\Q$base/\E]B= $_ eq $base
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | for my $dir (@{$self->{ST_IMPLICIT_DIRS}}) { | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $dad = dirname($dir); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | $co{$dad}++ if $sil->lsco([qw(-s -cvi -d)], $dad)->qx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | return wantarray? sort keys %co : scalar keys %co; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub mvfsdrive { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mvfsdrive: not called CC=1 SCAR=0.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | if (MSWIN && ! $self->{ST_MVFSDRIVE}) { | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | ▶ | no strict 'subs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 1 | ▶ | use vars '$Registry'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | require Win32::TieRegistry; | ||||||||||||||||||||||||||||||||||||||||||
| 215 | # HKLM is read-only for non-admins so open read-only | ||||||||||||||||||||||||||||||||||||||||||
| 216 | Win32::TieRegistry->import('TiedRef', '$Registry', qw(KEY_READ)); | ||||||||||||||||||||||||||||||||||||||||||
| 217 | my $LMachine = $Registry->Open('LMachine', {Access => KEY_READ}); | ||||||||||||||||||||||||||||||||||||||||||
| 218 | $self->{ST_MVFSDRIVE} = $LMachine->{SYSTEM}-> | ||||||||||||||||||||||||||||||||||||||||||
| 219 | {CurrentControlSet}->{Services}->{Mvfs}->{Parameters}->{drive}; | ||||||||||||||||||||||||||||||||||||||||||
| 220 | die "$0: Error: unable to find MVFS drive" unless $self->{ST_MVFSDRIVE}; | ||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return $self->{ST_MVFSDRIVE}; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub ccsymlink { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ccsymlink: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $dst = shift; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | return 1 if -l $dst; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return 0 unless MSWIN || CYGWIN; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $ct = new ClearCase::Argv({autochomp=>1, stderr=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | return $ct->des([qw(-fmt %m)], $dst)->qx eq 'symbolic link'; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | # readlink might work under some conditions (CC version, mount options, ...) | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub readcclink { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readcclink: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $dst = shift; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $ret = readlink $dst; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | return $ret if $ret || !(MSWIN || CYGWIN); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$ret or
MC/DC0%0/1
$ret or
$ret
Truth table0%0/2
A
A= $ret
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $ct = new ClearCase::Argv({autochomp=>1}); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $ret = $ct->ls($dst)->qx; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $ret =~ s%\\%/%g if MSWIN; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | return (($ret =~ s/^.*? --> (.*)$/$1/)? $ret : ''); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub srcbase { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
srcbase: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $sbase = File::Spec->rel2abs(shift); | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $sbase =~ s%\\%/%g; # rel2abs forces native (\) separator | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $sbase =~ s%/\.$%%; # workaround for bug in File::Spec 0.82 | |||||||||||||||||||||||||||||||||||||||||
| 250 | # File::Spec::Win32::rel2abs leaves trailing / on drive letter root. | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | $sbase =~ s%/*$%% if $sbase ne '/'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->{ST_SRCBASE} = $sbase; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | *src_slink = sub { return -l shift }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | *src_rlink = sub { return readlink shift }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | if (MSWIN || CYGWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 256 | my $ct = $self->clone_ct({autofail=>1, autochomp=>1}); | ||||||||||||||||||||||||||||||||||||||||||
| 257 | my $olddir = getcwd; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | $ct->_chdir($sbase) || die "$0: Error: $sbase: $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 259 | if ($ct->pwv(['-s'])->qx !~ /\s+NONE\s+/) { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | *src_slink = \&ccsymlink; | ||||||||||||||||||||||||||||||||||||||||||
| 261 | *src_rlink = \&readcclink; | ||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | $ct->_chdir($olddir); | ||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | return $self->{ST_SRCBASE}; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | sub dstbase { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dstbase: not called CC=10 SCAR=45.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my $dbase = shift; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | -e $dbase || mkpath($dbase, 0, 0777) || die "$0: Error: $dbase: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $dbase or mkpath($dbase, 0, 511)
MC/DC0%0/2
-e $dbase or mkpath($dbase, 0, 511)
-e $dbase
mkpath($dbase, 0, 511)
Truth table0%0/3
A or B
A= -e $dbaseB= mkpath($dbase, 0, 511)
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $ct = $self->clone_ct({autofail=>1, autochomp=>1}); | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my $olddir = getcwd; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $ct->_chdir($dbase) || die "$0: Error: $dbase: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $dbase = getcwd; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my $dv = $ct->pwv(['-s'])->qx; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | die "$0: Error: destination base ($dbase) not in a view/VOB context" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $dv or $dv =~ /\sNONE\s/
MC/DC0%0/2
not $dv or $dv =~ /\sNONE\s/
not $dv
$dv =~ /\sNONE\s/
Truth table0%0/3
not(A) or B
A= not $dvB= $dv =~ /\sNONE\s/
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | if !$dv || $dv =~ m%\sNONE\s%; | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->dstview($dv); | |||||||||||||||||||||||||||||||||||||||||
| 282 | # We need to derive the current vob of the dest path, which we | ||||||||||||||||||||||||||||||||||||||||||
| 283 | # do by cd-ing there temporarily and running "ct desc -s vob:.". | ||||||||||||||||||||||||||||||||||||||||||
| 284 | # But with a twist because of @%$*&# Windows. | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $dvob; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if (!($dvob = $self->dstvob)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | # We need this weird hack to get a case-correct version of the | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # dest path, in case the user typed it in random case. There | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # appears to be a bug in CC 4.2; "ct desc vob:foo" fails if | ||||||||||||||||||||||||||||||||||||||||||
| 290 | # "foo" is not the right case even if MVFS is set to be | ||||||||||||||||||||||||||||||||||||||||||
| 291 | # case insensitive. This is caseid v0869595, bugid CMBU00055321. | ||||||||||||||||||||||||||||||||||||||||||
| 292 | # Since Windows mount points must be at the root level, | ||||||||||||||||||||||||||||||||||||||||||
| 293 | # we assume the vob tag must be the root dir name. We must | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # still then look that up in lsvob to get the tag case right. | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | if (MSWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 296 | my @vobs = $ct->lsvob(['-s'])->qx; | ||||||||||||||||||||||||||||||||||||||||||
| 297 | my $dirpart = (File::Spec->splitpath($dbase, 1))[1]; | ||||||||||||||||||||||||||||||||||||||||||
| 298 | for my $name (File::Spec->splitdir($dirpart)) { | ||||||||||||||||||||||||||||||||||||||||||
| 299 | last if $dvob; | ||||||||||||||||||||||||||||||||||||||||||
| 300 | next unless $name; | ||||||||||||||||||||||||||||||||||||||||||
| 301 | for my $vob (@vobs) { | ||||||||||||||||||||||||||||||||||||||||||
| 302 | if ($vob =~ m%^[/\\]$name$%i) { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | ($dvob = $vob) =~ s%\\%/%g; | ||||||||||||||||||||||||||||||||||||||||||
| 304 | last; | ||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | $dvob = $ct->desc(['-s'], "vob:.")->qx; | |||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->dstvob($dvob); | |||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | # On Windows, normalize the specified dstbase to use the | ||||||||||||||||||||||||||||||||||||||||||
| 314 | # MVFS drive (typically M:), e.g. M:\view-name\vob-tag\path... | ||||||||||||||||||||||||||||||||||||||||||
| 315 | # This avoids all kinds of problems with using the view | ||||||||||||||||||||||||||||||||||||||||||
| 316 | # via a different drive letter or a UNC (\\view) path. | ||||||||||||||||||||||||||||||||||||||||||
| 317 | # Similarly, on UNIX we normalize to a view-extended path | ||||||||||||||||||||||||||||||||||||||||||
| 318 | # even if we're already in a set view because it's the | ||||||||||||||||||||||||||||||||||||||||||
| 319 | # lowest common denominator. Also, if the set view differs | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # from the 'dest view', the dest view should win. | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | if (MSWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 322 | $dbase =~ s%\\%/%g; | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | ▶ | use vars '%RegHash'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | require Win32::TieRegistry; | ||||||||||||||||||||||||||||||||||||||||||
| 325 | Win32::TieRegistry->import('TiedHash', '%RegHash'); | ||||||||||||||||||||||||||||||||||||||||||
| 326 | my $mdrive = $self->mvfsdrive; | ||||||||||||||||||||||||||||||||||||||||||
| 327 | $dbase = getcwd; | ||||||||||||||||||||||||||||||||||||||||||
| 328 | $dbase =~ s%.*?$dvob%$mdrive:/$dv$dvob%i; | ||||||||||||||||||||||||||||||||||||||||||
| 329 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $dbase = getcwd; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | if (CYGWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 332 | $dbase =~ s%^/(/?view/$dv|cygdrive/\w)%%; | ||||||||||||||||||||||||||||||||||||||||||
| 333 | $dbase = "//view/$dv$dbase"; | ||||||||||||||||||||||||||||||||||||||||||
| 334 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $dbase =~ s%^/view/$dv%%; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $dbase = "/view/$dv$dbase"; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | $ct->_chdir($olddir) || die "$0: Error: $olddir: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $self->{ST_DSTBASE} = $dbase; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | (my $dvb = $dbase) =~ s%^(.*?$dvob).*$%$1%; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | $self->snapdest(1) unless -e "$dvb/@@"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return $self->{ST_DSTBASE}; | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | # We may have created a view-private parent tree, so must | ||||||||||||||||||||||||||||||||||||||||||
| 348 | # work our way upwards till we get to a versioned dir. | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | sub _mkbase { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mkbase: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if (! $self->{ST_MKBASE}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $mbase = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my $dvob = $self->dstvob; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | (my $dext = $mbase) =~ s%(.*?$dvob)/.*%$1%; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $ct = $self->clone_ct({stdout=>0, stderr=>0, autofail=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | last if length($mbase) <= length($dext); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | last if -d $mbase && ! $ct->desc(['-s'], "$mbase/.@@")->system; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $mbase and not $ct->desc(["-s"], "$mbase/.\@\@")->system
MC/DC0%0/2
-d $mbase and not $ct->desc(["-s"], "$mbase/.\@\@")->system
-d $mbase
not $ct->desc(["-s"], "$mbase/.\@\@")->system
Truth table0%0/3
A and not(B)
A= -d $mbaseB= not $ct->desc(["-s"], "$mbase/.\@\@")->system
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | push(@{$self->{ST_IMPLICIT_DIRS}}, $mbase); | |||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $mbase = dirname($mbase); | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $self->{ST_MKBASE} = $mbase; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return $self->{ST_MKBASE}; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | sub dstvob { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dstvob: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $self->{ST_DSTVOB} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $self->{ST_DSTVOB} =~ s%\\%/%g; | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | return $self->{ST_DSTVOB}; | |||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub srclist { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
srclist: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | my $type = ref($_[0]) ? ${shift @_} : 'NORMAL'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $sbase = $self->srcbase; | |||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | die "$0: Error: must specify src base before src list" if !$sbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | for (@_) { | |||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | next if $_ eq $sbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if (m%^(?:[a-zA-Z]:)?$sbase[/\\]*(.+)%) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $self->{ST_SRCMAP}->{$1}->{type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } elsif (-e "$sbase/$_") { | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $self->{ST_SRCMAP}->{$_}->{type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 387 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | warn "Warning: $_: no such file or directory\n"; | |||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | sub srcmap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
srcmap: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | my $type = ref($_[0]) ? ${shift @_} : 'NORMAL'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my %sdmap = @_; | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my $sbase = $self->srcbase; | |||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $dbase = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | die "$0: Error: must specify src base before src map" if !$sbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | die "$0: Error: must specify dst base before src map" if !$dbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | for (keys %sdmap) { | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | if (m%^(?:[a-zA-Z]:)?\Q$sbase\E[/\\]*(.*)$%) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my $key = $1; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $self->{ST_SRCMAP}->{$key}->{type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my($dst) = ($sdmap{$_} =~ m%^\Q$dbase\E[/\\]*(.+)$%); | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $self->{ST_SRCMAP}->{$key}->{dst} = $dst; | |||||||||||||||||||||||||||||||||||||||||
| 407 | } elsif (-e $_) { | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $self->{ST_SRCMAP}->{$_}->{type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if ($sdmap{$_} =~ m%^\Q$dbase\E[/\\]*(.+)$%) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | $self->{ST_SRCMAP}->{$_}->{dst} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 411 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $self->{ST_SRCMAP}->{$_}->{dst} = $sdmap{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | } elsif (-e "$sbase/$_") { | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $self->{ST_SRCMAP}->{$_}->{type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $self->{ST_SRCMAP}->{$_}->{dst} = $sdmap{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | warn "Warning: $_: no such file or directory\n"; | |||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | sub eltypemap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eltypemap: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | %{$self->{ST_ELTYPEMAP}} = @_ if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | return $self->{ST_ELTYPEMAP} ? %{$self->{ST_ELTYPEMAP}} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | sub dstcheck { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dstcheck: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $dbase = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | die "$0: Error: must specify dest base before dstcheck" if !$dbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my @existing = (); | |||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | if (-e $dbase) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | # Check for view private files under the dest base. | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my @vp = $self->_lsprivate(0); | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my $n = @vp; | |||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | my $s = $n == 1 ? '' : 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | my $es = $n == 1 ? 's' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | die "$0: Error: $n view-private file$s exist$es under $dbase:\n @vp\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | if @vp; | ||||||||||||||||||||||||||||||||||||||||||
| 442 | # Check for checkouts under the dest base. | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | @existing = $self->_lsco; | |||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | $n = @existing; | |||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | $s = $n >= 2 ? 's' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | if ($n == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | # do nothing | ||||||||||||||||||||||||||||||||||||||||||
| 448 | } elsif ($self->ignore_co) { | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | warning "skipping $n checkout$s under $dbase"; | |||||||||||||||||||||||||||||||||||||||||
| 450 | } elsif ($self->overwrite_co) { | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | warning "overwriting $n checkout$s under $dbase"; | |||||||||||||||||||||||||||||||||||||||||
| 452 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | fatal("$n checkout$s found under $dbase"); | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $self->{ST_PRE} = { map {$_ => 1} @existing }; | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | # Comparator function used to implement the -vreuse option | ||||||||||||||||||||||||||||||||||||||||||
| 460 | # If the default comparaison fails, look at versions of suitable size | ||||||||||||||||||||||||||||||||||||||||||
| 461 | # in the version tree, and apply the comparaison to them. | ||||||||||||||||||||||||||||||||||||||||||
| 462 | # If a suitable version is found, add it to a list of versions on which | ||||||||||||||||||||||||||||||||||||||||||
| 463 | # to apply a label. | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | sub vtcomp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vtcomp: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my($self, $src, $dst) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my $cmp = $self->cmp_func; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | my $lb = $self->lblver; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | if ($lb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $lblver = "$dst\@\@/$lb"; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | $dst = $lblver if -r $lblver; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | return 0 unless $cmp->($src, $dst); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | my $vt = ClearCase::Argv->lsvtree([qw(-a -s -nco)]); | |||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my @vt = reverse grep {m%[\\/]\d*$%} $vt->args($dst)->qx; | |||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | chomp @vt; | |||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $sz = -s $src; | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | for (@vt) { | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | next if -s $_ != $sz; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | if (!$cmp->($src, $_)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | push @{$self->{ST_LBL}}, $_; | |||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | sub _needs_update { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_needs_update: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my($self, $src, $dst, $comparator) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $update = 0; | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if (src_slink($src) && ccsymlink($dst)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
src_slink($src) and ccsymlink($dst)
MC/DC0%0/2
src_slink($src) and ccsymlink($dst)
src_slink($src)
ccsymlink($dst)
Truth table0%0/3
A and B
A= src_slink($src)B= ccsymlink($dst)
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | my $srctext = src_rlink($src); | |||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | my $desttext = readcclink $dst; | |||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | $update = !defined($comparator) || ($srctext ne $desttext); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!defined($comparator) || $srctext ne $desttext
MC/DC0%0/2
!defined($comparator) || $srctext ne $desttext
!defined($comparator)
$srctext ne $desttext
Truth table0%0/3
not(A) || B
A= !defined($comparator)B= $srctext ne $desttext
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | ▶ | } elsif (! src_slink($src) && ! ccsymlink($dst)) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
src_slink($src) || ccsymlink($dst)
MC/DC0%0/2
src_slink($src) || ccsymlink($dst)
src_slink($src)
ccsymlink($dst)
Truth table0%0/3
A || B
A= src_slink($src)B= ccsymlink($dst)
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | if (!defined($comparator)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $update = 1; | |||||||||||||||||||||||||||||||||||||||||
| 497 | } elsif ($self->vreuse) { | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $update = $self->vtcomp($src, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 499 | } elsif (-s $src != -s $dst) { | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $update = 1; | |||||||||||||||||||||||||||||||||||||||||
| 501 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $update = &$comparator($src, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | $self->failm("failed comparing $src vs $dst: $!") if $update < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $update = 1; | |||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if ($update && (!exists($self->{ST_PRE}->{$dst}) || $self->overwrite_co)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$update and !exists $self->{"ST_PRE"}{$dst} || $self->overwrite_co
not exists $self->{"ST_PRE"}{$dst} or $self->overwrite_co
MC/DC0%0/3
$update and !exists $self->{"ST_PRE"}{$dst} || $self->overwrite_co
$update
not exists $self->{"ST_PRE"}{$dst}
$self->overwrite_co
Truth table0%0/4
A and not(B) or C
A= $updateB= not exists $self->{"ST_PRE"}{$dst}C= $self->overwrite_co
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 510 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | sub checkcs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkcs: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | my($dest) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | my $ct = ClearCase::Argv->new({autofail=>1, autochomp=>1}); | |||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my $pwd = getcwd; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | $ct->_chdir($dest) || die "$0: Error: $dest: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $dest = getcwd; | |||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | my @cs = grep /^\#\#:BranchOff: *root/, $ct->argv('catcs')->qx; | |||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | $ct->_chdir($pwd) || die "$0: Error: $pwd: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | return scalar @cs; | |||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | sub analyze { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
analyze: not called CC=36 SCAR=71.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | my $type = ref($_[0]) ? ${shift @_} : 'NORMAL'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my $sbase = $self->srcbase; | |||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $dbase = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | die "$0: Error: must specify dest base before analyzing" if !$dbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | die "$0: Error: must specify dest vob before analyzing" if !$self->dstvob; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | $self->_mkbase; | |||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $self->{branchoffroot} = $self->checkcs($dbase); | |||||||||||||||||||||||||||||||||||||||||
| 536 | # Derive the add and modify lists by traversing the src map and | ||||||||||||||||||||||||||||||||||||||||||
| 537 | # comparing src/dst files. | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | delete $self->{ST_ADD}; | |||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | delete $self->{ST_MOD}; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | my @sl = $dbase eq $self->{ST_MKBASE}? sort grep{-d $_} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | $self->clone_ct->find($dbase, qw(-type l -print))->qx : (); | ||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | map { $_ = "/$_" } @sl if CYGWIN; # mismatch between conventions | |||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if (@sl) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my %sl = map{ $_ => 1} @sl; | |||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | for my $l (@sl) { | |||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | my $s = $l; | |||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | $s =~ s%^\Q$dbase\E/(.*)$%$1%; | |||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if (exists $self->{ST_SRCMAP}->{$s}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $s = join('/', $sbase, $s); | |||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | delete $sl{$l} if src_slink($s); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | @sl = sort keys %sl; | |||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | my $comparator = $self->no_cmp ? undef : $self->cmp_func; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | SRC: for (sort keys %{$self->{ST_SRCMAP}}) { | |||||||||||||||||||||||||||||||||||||||||
| 557 | next if $self->{ST_SRCMAP}->{$_}->{type} && | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | $self->{ST_SRCMAP}->{$_}->{type} !~ /$type/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"ST_SRCMAP"}{$_}{"type"} and not $self->{"ST_SRCMAP"}{$_}{"type"} =~ /$type/
MC/DC0%0/2
$self->{"ST_SRCMAP"}{$_}{"type"} and not $self->{"ST_SRCMAP"}{$_}{"type"} =~ /$type/
$self->{"ST_SRCMAP"}{$_}{"type"}
not $self->{"ST_SRCMAP"}{$_}{"type"} =~ /$type/
Truth table0%0/3
A and not(B)
A= $self->{"ST_SRCMAP"}{$_}{"type"}B= not $self->{"ST_SRCMAP"}{$_}{"type"} =~ /$type/
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $src = join('/', $sbase, $_); | |||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | $src = $_ unless -e $src || src_slink($src); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $src or src_slink($src)
MC/DC0%0/2
-e $src or src_slink($src)
-e $src
src_slink($src)
Truth table0%0/3
A or B
A= -e $srcB= src_slink($src)
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | my $dst = join('/', $dbase, $self->{ST_SRCMAP}->{$_}->{dst} || $_); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'ST_SRCMAP'}{$_}{'dst'} || $_
MC/DC0%0/2
$self->{'ST_SRCMAP'}{$_}{'dst'} || $_
$self->{'ST_SRCMAP'}{$_}{'dst'}
$_
Truth table0%0/3
A || B
A= $self->{'ST_SRCMAP'}{$_}{'dst'}B= $_
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | for my $s (@sl) { | |||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | if ($dst =~ /^\Q$s\E/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | $self->{ST_DIRLNK}->{$s} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $self->{ST_ADD}->{$_}->{src} = $src; | |||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $self->{ST_ADD}->{$_}->{dst} = $dst; | |||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | next SRC; | |||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 570 | # It's possible for a symlink to not satisfy -e if it's dangling. | ||||||||||||||||||||||||||||||||||||||||||
| 571 | # Case-insensitive file test operators are a problem on Windows. | ||||||||||||||||||||||||||||||||||||||||||
| 572 | # You cannot modify files when they don't exist under the proper name. | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | if (! ecs($dst) && ! ccsymlink($dst)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
ecs($dst) || ccsymlink($dst)
MC/DC0%0/2
ecs($dst) || ccsymlink($dst)
ecs($dst)
ccsymlink($dst)
Truth table0%0/3
A || B
A= ecs($dst)B= ccsymlink($dst)
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $self->{ST_ADD}->{$_}->{src} = $src; | |||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $self->{ST_ADD}->{$_}->{dst} = $dst; | |||||||||||||||||||||||||||||||||||||||||
| 576 | ▶ | } elsif (! -d $src || src_slink($src)) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not -d $src or src_slink($src)
MC/DC0%0/2
not -d $src or src_slink($src)
not -d $src
src_slink($src)
Truth table0%0/3
not(A) or B
A= not -d $srcB= src_slink($src)
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | if ($self->_needs_update($src, $dst, $comparator)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $self->{ST_MOD}->{$_}->{src} = $src; | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $self->{ST_MOD}->{$_}->{dst} = $dst; | |||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | if ($self->{ST_DIRLNK}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | my @rem; | |||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my @slst = sort keys %{$self->{ST_DIRLNK}}; | |||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | for (reverse @slst) { | |||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | for my $l (@slst) { | |||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | if (/^\Q$l\E./) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | push @rem, $_; | |||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | delete @{$self->{ST_DIRLNK}}{@rem} if @rem; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | unlink $self->{ST_DIRLNK} unless keys %{$self->{ST_DIRLNK}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||
| 597 | # Last, check for subtractions but only if asked - it's potentially | ||||||||||||||||||||||||||||||||||||||||||
| 598 | # expensive and error-prone. | ||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | return unless $self->remove; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | my(%dirs, %files, %xfiles); | |||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | my $wanted = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | my $path = $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | return if $path eq $dbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | if ($path =~ /lost\+found/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $File::Find::prune = 1; | |||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | # Get a relative path from the absolute path. | ||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | (my $relpath = $path) =~ s%^\Q$dbase\E\W?%%; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | if (ccsymlink($path)) { # Vob link | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $files{$relpath} = $path; | |||||||||||||||||||||||||||||||||||||||||
| 612 | } elsif (-d $path) { | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $dirs{$path} = $relpath; | |||||||||||||||||||||||||||||||||||||||||
| 614 | } elsif (-f $path) { | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $files{$relpath} = $path; | |||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | find($wanted, $dbase); | |||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | my %dst2src; | |||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | for (keys %{$self->{ST_SRCMAP}}) { | |||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | my $dst = $self->{ST_SRCMAP}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | ▶ | $dst2src{$dst} = $_ if $dst; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | for (sort keys %files) { | |||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | next if $self->{ST_SRCMAP}->{$_} && !$self->{ST_SRCMAP}->{$_}->{dst}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"ST_SRCMAP"}{$_} and not $self->{"ST_SRCMAP"}{$_}{"dst"}
MC/DC0%0/2
$self->{"ST_SRCMAP"}{$_} and not $self->{"ST_SRCMAP"}{$_}{"dst"}
$self->{"ST_SRCMAP"}{$_}
not $self->{"ST_SRCMAP"}{$_}{"dst"}
Truth table0%0/3
A and not(B)
A= $self->{"ST_SRCMAP"}{$_}B= not $self->{"ST_SRCMAP"}{$_}{"dst"}
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | $xfiles{$files{$_}}++ if !$dst2src{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | $self->{ST_SUB}->{exfiles} = \%xfiles; | |||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | $self->{ST_SUB}->{dirs} = \%dirs; | |||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | sub preview { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preview: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $indent = ' ' x 4; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | my($adds, $mods, $subs) = (0, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | if ($self->{ST_DIRLNK}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | my $dl = keys %{$self->{ST_DIRLNK}}; | |||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | print "Removing $dl directory symlinks:\n"; | |||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | for (sort keys %{$self->{ST_DIRLNK}}) { | |||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | print "${indent}$_\n"; | |||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | if ($self->{ST_ADD}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | $adds = keys %{$self->{ST_ADD}}; | |||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | print "Adding $adds elements:\n"; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | for (sort keys %{$self->{ST_ADD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 647 | printf "$indent%s +=>\n\t%s\n", $self->{ST_ADD}->{$_}->{src}, | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $self->{ST_ADD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | if ($self->{ST_MOD}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $mods = keys %{$self->{ST_MOD}}; | |||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | print "Modifying $mods elements:\n"; | |||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | for (sort keys %{$self->{ST_MOD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 655 | printf "$indent%s ==>\n\t%s\n", $self->{ST_MOD}->{$_}->{src}, | ||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $self->{ST_MOD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if ($self->remove && $self->{ST_SUB}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->remove and $self->{"ST_SUB"}
MC/DC0%0/2
$self->remove and $self->{"ST_SUB"}
$self->remove
$self->{"ST_SUB"}
Truth table0%0/3
A and B
A= $self->removeB= $self->{"ST_SUB"}
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | my @exfiles = sort keys %{$self->{ST_SUB}->{exfiles}}; | |||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | $subs = @exfiles; | |||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | print "Subtracting $subs elements:\n" if $subs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | for (@exfiles) { | |||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | printf "$indent%s\n", $_; | |||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | my $total = $adds + $mods + $subs; | |||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | print "Element change summary: add=$adds modify=$mods subtract=$subs\n"; | |||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | return $total; | |||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | sub pbrtype { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pbrtype: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | my $bt = shift; | |||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | my $ct = $self->clone_ct; | |||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | my $vob = $self->{ST_DSTVOB}; | |||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | ▶ | if (!defined($self->{ST_PBTYPES}->{$bt})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | my $tc = $ct->des([qw(-fmt %[type_constraint]p)], | |||||||||||||||||||||||||||||||||||||||||
| 679 | "brtype:$bt\@$vob")->qx; | ||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | $self->{ST_PBTYPES}->{$bt} = ($tc =~ /one version per branch/); | |||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | return $self->{ST_PBTYPES}->{$bt}; | |||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | sub branchco { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
branchco: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | my $dir = shift; | |||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | my @ele = @_; | |||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | my $ct = $self->clone_ct({autochomp=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | my $rc; | |||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | if ($self->{branchoffroot}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | foreach my $e (@ele) { | |||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my $sel = $ct->ls(['-d'], $e)->autochomp(1)->qx; | |||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | if ($sel =~ /^(.*?) +Rule:.*-mkbranch (.*?)\]?$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | my ($ver, $bt) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | my $sil = $self->clone_ct({stdout=>0, stderr=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | my $main = 'main'; | |||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | if ($sil->des(['-s'], "$e\@\@/main/0")->system) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | $main = ($ct->lsvtree($e)->autochomp(1)->qx)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $main =~ s%^[^@]*\@\@[\\/](.*)\r?$%$1%; | |||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | my $re = $self->pbrtype($bt) ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 703 | qr([\\/]${main}[\\/]$bt[\\/]\d+$) : qr([\\/]$bt[\\/]\d+$); | ||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | ▶ | if ($ver =~ m%$re%) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | $rc |= $ct->co($self->comment, $e)->system; | |||||||||||||||||||||||||||||||||||||||||
| 706 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | my $r = $ct->mkbranch([@{$self->comment}, '-ver', | |||||||||||||||||||||||||||||||||||||||||
| 708 | "/${main}/0", $bt], $e)->system; | ||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | if ($r) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $rc = 1; | |||||||||||||||||||||||||||||||||||||||||
| 711 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | if ($ver !~ m%\@\@[\\/]${main}[\\/]0$%) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | $rc |= $dir ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | $ct->merge(['-to', $e], | ||||||||||||||||||||||||||||||||||||||||||
| 715 | $ver)->stdout(0)->system : | ||||||||||||||||||||||||||||||||||||||||||
| 716 | $ct->merge(['-ndata', '-to', $e], | ||||||||||||||||||||||||||||||||||||||||||
| 717 | $ver)->stdout(0)->system; | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | unlink("$e.contrib"); | |||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||
| 722 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $rc |= $ct->co($self->comment, $e)->system; | |||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||
| 726 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | $rc = $ct->co($self->comment, @ele)->system; | |||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | return $rc; | |||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | sub rmdirlinks { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rmdirlinks: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | return unless $self->{ST_DIRLNK}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my $lsco = ClearCase::Argv->lsco([qw(-s -d -cview)]); | |||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | for (sort {$b cmp $a} keys %{$self->{ST_DIRLNK}}) { | |||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my $dad = dirname $_; | |||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | ▶ | $self->branchco(1, $dad) unless $lsco->args($dad)->qx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | $self->clone_ct->rm($_)->system; | |||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | delete $self->{ST_SUB}->{exfiles}->{$_}; #If it is there | |||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | ▶ | sub mkrellink { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkrellink: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | my ($self, $src) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | my $txt = src_rlink($src); | |||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $sbase = $self->srcbase; | |||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | return $txt unless $self->{ST_RELLINKS} and ($txt =~ /^$sbase/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"ST_RELLINKS"} and $txt =~ /^$sbase/
MC/DC0%0/2
$self->{"ST_RELLINKS"} and $txt =~ /^$sbase/
$self->{"ST_RELLINKS"}
$txt =~ /^$sbase/
Truth table0%0/3
A and B
A= $self->{"ST_RELLINKS"}B= $txt =~ /^$sbase/
| |||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $txt =~ s%^$sbase/(.*)%$1%; | |||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $src =~ s%^$sbase/(.*)%$1%; | |||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | my @t = split m%/%, $txt; | |||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | my @s = split m%/%, $src; | |||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | while ($t[$i] eq $s[$i]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | shift @t; | |||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | shift @s; | |||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | ▶ | while ($i++ < $#s) { unshift @t, '..'; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | $txt = join '/', @t; | |||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | return $txt; | |||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | # Remove spurious names from restored directory | ||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | sub skimdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skimdir: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my ($self, $dst, $pfx) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | my $flt = qr{^(\Q$pfx\E.*?)(?:/.*)?$}; # paths normalized | |||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | opendir(DIR, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | my @f = grep !m%^\.\.?$%, readdir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | closedir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | my %ok = map {$_ => 1} grep s%$flt%$1%, keys %{$self->{ST_SRCMAP}}; | |||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | for (@f) { | |||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | my $f = $pfx . $_; | |||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | ▶ | $self->{ST_SUB}->{exfiles}->{join('/', $dst, $_)}++ unless $ok{$f}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | sub vtree { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vtree: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | my ($self, $dir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | ▶ | if (!exists $self->{ST_VT}->{$dir}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | my $vt = ClearCase::Argv->lsvtree({autochomp=>1}, [qw(-a -s -nco)]); | |||||||||||||||||||||||||||||||||||||||||
| 782 | # optimization: branch/0 of a directory is either empty or duplicate | ||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | ▶ | my @vt = reverse grep { m%[/\\](\d+)$% && $1>=1 } $vt->args($dir)->qx; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
m([/\\](\d+)$) && $1 >= 1
MC/DC0%0/2
m([/\\](\d+)$) && $1 >= 1
m([/\\](\d+)$)
$1 >= 1
Truth table0%0/3
A && B
A= m([/\\](\d+)$)B= $1 >= 1
| |||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | $self->{ST_VT}->{$dir} = \@vt; | |||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | return $self->{ST_VT}->{$dir}; | |||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | # Once a directory version was found, move it first in the list for next tries | ||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | ▶ | sub raise_dver { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raise_dver: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | my ($self, $i, $dir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | ▶ | return unless $i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | my $vt = $self->{ST_VT}->{$dir}; | |||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | my $ver = splice @{$vt}, $i, 1; | |||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | unshift @{$vt}, $ver; | |||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | # Reuse from removed elements, or create as view private, directories | ||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | sub reusemkdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reusemkdir: not called CC=33 SCAR=70.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | my ($self, $dref, $rref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | my (%found, %dfound, %priv); | |||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | my $snapview = $self->snapdest; | |||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | my $ds = ClearCase::Argv->desc({stderr=>1},[qw(-s)]); | |||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | my $dm = ClearCase::Argv->desc([qw(-fmt %m)]); | |||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $rm = ClearCase::Argv->rm; | |||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | my $lsco = ClearCase::Argv->lsco([qw(-s -d -cview)]); | |||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | my $ln = ClearCase::Argv->ln; | |||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | for my $dst (sort keys %{$dref}) { | |||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | next if $dfound{$dst}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my $reused; | |||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | my($name, $dir) = fileparse($dst); | |||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | if (!$priv{$dir}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | if ($rref->{$dst}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | $self->branchco(1, $dir) unless $lsco->args($dir)->qx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $rm->args($dst)->system; | |||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | my $i = -1; #index in the vtree list | |||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | VER: for (@{$self->vtree($dir)}) { | |||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | my $dirext = "$_/$name"; | |||||||||||||||||||||||||||||||||||||||||
| 821 | # case-insensitive file test operator on Windows is a problem | ||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | if ($snapview ? $ds->args($dirext)->qx !~ /Error:/ : ecs($dirext)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | ▶ | next if $dm->args($dirext)->qx eq 'file element'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | ▶ | while (ccsymlink($dirext)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | $name = readcclink $dirext; | |||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $name =~ s/\@\@$//; | |||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | $dirext = "$_/$name"; | |||||||||||||||||||||||||||||||||||||||||
| 828 | # consider only relative, and local symlinks | ||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | next VER if !ecs($dirext) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ecs($dirext) or $dm->args($dirext)->qx eq "file element"
MC/DC0%0/2
not ecs($dirext) or $dm->args($dirext)->qx eq "file element"
not ecs($dirext)
$dm->args($dirext)->qx eq "file element"
Truth table0%0/3
not(A) or B
A= not ecs($dirext)B= $dm->args($dirext)->qx eq "file element"
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | $dm->args($dirext)->qx eq 'file element'; | ||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | $reused = 1; | |||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $self->raise_dver($i, $dir); | |||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | ▶ | $self->branchco(1, $dir) unless $lsco->args($dir)->qx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | $ln->args($dirext, $dst)->system; | |||||||||||||||||||||||||||||||||||||||||
| 836 | # Need to reevaluate all the files under this dir | ||||||||||||||||||||||||||||||||||||||||||
| 837 | # The case of implicit dirs, is recorded as '.' | ||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | my $d = $dref->{$dst} eq '.'? '' : $dref->{$dst} . '/'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | $self->skimdir($dst, $d) if $self->remove; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | ▶ | my $cmp = $self->no_cmp ? undef : $self->cmp_func; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | my @keys = sort $d? grep m%^\Q$d\E%, keys %{$self->{ST_ADD}} | |||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | ▶ | : keys %{$self->{ST_ADD}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | for my $e (@keys) { | |||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | my $edst = join '/', $self->dstbase, $e; | |||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | my @intdir = split m%/%, $e; | |||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | pop @intdir; | |||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | if (@intdir) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | my $dd = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | my $pf = ''; | |||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | while (my $id = shift @intdir) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | $dd = join '/', $dd, $id; | |||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | $pf = $pf . $id . '/'; | |||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | ▶ | $self->skimdir($dd, $pf) if -d $dd && !$dfound{$dd}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $dd and not $dfound{$dd}++
MC/DC0%0/2
-d $dd and not $dfound{$dd}++
-d $dd
not $dfound{$dd}++
Truth table0%0/3
A and not(B)
A= -d $ddB= not $dfound{$dd}++
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||
| 856 | # Problem: does it match the type under srcbase? | ||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | ▶ | if (-d $edst and !ccsymlink($edst)) { # We know it is empty | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $edst and not ccsymlink($edst)
MC/DC0%0/2
-d $edst and not ccsymlink($edst)
-d $edst
not ccsymlink($edst)
Truth table0%0/3
A and not(B)
A= -d $edstB= not ccsymlink($edst)
| |||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | opendir(DIR, $edst); | |||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | my @f = grep !m%^\.\.?$%, readdir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | closedir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | if (@f) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | $self->branchco(1, $edst) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 863 | unless $lsco->args($edst)->qx; | ||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | $rm->args(map{join '/', $edst, $_} @f)->system; | |||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | $dfound{$edst}++; #Skip in this loop | |||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | ▶ | if (exists($self->{ST_ADD}->{$e}->{dst})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | my $src = $self->{ST_ADD}->{$e}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | my $dst = $self->{ST_ADD}->{$e}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | if (-e $dst) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | $self->{ST_MOD}->{$e} = $self->{ST_ADD}->{$e} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | if $self->_needs_update($src, $dst, $cmp); | ||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | $found{$e}++; #Remove from the add list | |||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | ▶ | if (!$reused) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my $err; | |||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | mkpath($dst, {error => \$err, verbose => 0, mode => 0777}); | |||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | $self->failm(join(': ', %{$err->[0]})) if $err and @{$err}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$err and @{$err;}
MC/DC0%0/2
$err and @{$err;}
$err
@{$err;}
Truth table0%0/3
A and B
A= $errB= @{$err;}
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | $priv{"${dst}/"}++; | |||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | return %found; | |||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | # recursively record parent directories, and clashing objects to remove | ||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | ▶ | sub recadd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recadd: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | my ($self, $src, $dst, $dir, $rm, $seen) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | my $dad = dirname($dst); | |||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | return if $seen->{$dad}++ || (-d $dad && !ccsymlink($dad)); #exists, normal | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$seen->{$dad}++ or -d $dad and not ccsymlink($dad)
-d $dad and not ccsymlink($dad)
MC/DC0%0/3
$seen->{$dad}++ or -d $dad and not ccsymlink($dad)
$seen->{$dad}++
-d $dad
not ccsymlink($dad)
Truth table0%0/4
A or B and not(C)
A= $seen->{$dad}++B= -d $dadC= not ccsymlink($dad)
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | my $sdad = dirname($src); | |||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | $self->recadd($sdad, $dad, $dir, $rm, $seen); | |||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | $rm->{$dad}++ if -f $dad || ccsymlink($dad); #something clashing: remove | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-f $dad or ccsymlink($dad)
MC/DC0%0/2
-f $dad or ccsymlink($dad)
-f $dad
ccsymlink($dad)
Truth table0%0/3
A or B
A= -f $dadB= ccsymlink($dad)
| |||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | $dir->{$dad} = $sdad; | |||||||||||||||||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | sub add { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add: not called CC=67 SCAR=84.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my $sbase = $self->srcbase; | |||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | my $mbase = $self->_mkbase; | |||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | my $ct = $self->clone_ct; | |||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | return if ! $self->{ST_ADD}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | if ($self->reuse) { # First, reuse parent directories | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my (%dir, %rm, %dseen); | |||||||||||||||||||||||||||||||||||||||||
| 912 | # in the way if added in _mkbase as view private; ignore failures | ||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | rmdir($_) for reverse sort @{$self->{ST_IMPLICIT_DIRS}}; | |||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | for my $d (sort keys %{$self->{ST_ADD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | my $src = $self->{ST_ADD}->{$d}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | my $dst = $self->{ST_ADD}->{$d}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | $dir{$dst} = $d if -d $src && !src_slink($src); # empty dir | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $src and not src_slink($src)
MC/DC0%0/2
-d $src and not src_slink($src)
-d $src
not src_slink($src)
Truth table0%0/3
A and not(B)
A= -d $srcB= not src_slink($src)
| |||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | $self->recadd($d, $dst, \%dir, \%rm, \%dseen); | |||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | my %found = $self->reusemkdir(\%dir, \%rm); | |||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | delete $self->{ST_ADD}->{$_} for keys %found; | |||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | for (sort keys %{$self->{ST_ADD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | my $src = $self->{ST_ADD}->{$_}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | my $dst = $self->{ST_ADD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | my $err; | |||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | if (-d $src && ! src_slink($src)) { # Already checked in the reuse case | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
-d $src and not src_slink($src)
MC/DC0%0/2
-d $src and not src_slink($src)
-d $src
not src_slink($src)
Truth table0%0/3
A and not(B)
A= -d $srcB= not src_slink($src)
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | -e $dst || mkpath($dst, {error=>\$err, verbose=>0, mode=>0777}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | ▶ | $self->failm(join(': ', %{$err->[0]})) if $err and @{$err}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$err and @{$err;}
MC/DC0%0/2
$err and @{$err;}
$err
@{$err;}
Truth table0%0/3
A and B
A= $errB= @{$err;}
| |||||||||||||||||||||||||||||||||||||||||||
| 930 | } elsif (-e $src) { | ||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | my $dad = dirname($dst); | |||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | ▶ | -d $dad || mkpath($dad, {error=>\$err, verbose=>0, mode=>0777}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | $self->failm(join(': ', %{$err->[0]})) if $err and @{$err}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$err and @{$err;}
MC/DC0%0/2
$err and @{$err;}
$err
@{$err;}
Truth table0%0/3
A and B
A= $errB= @{$err;}
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | ▶ | if (src_slink($src)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | ▶ | open(SLINK, ">$dst$lext") || $self->failm("$dst$lext: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | print SLINK $self->mkrellink($src), "\n";; | |||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | close(SLINK); | |||||||||||||||||||||||||||||||||||||||||
| 938 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 939 | $self->{ST_CI_FROM}->{$_} = $self->{ST_ADD}->{$_} | ||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | if !exists($self->{ST_PRE}->{$dst}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||
| 942 | } elsif (src_slink($src)) { #Dangling symlink: import | ||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | ▶ | open(SLINK, ">$dst$lext") || $self->failm("$dst$lext: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | print SLINK $self->mkrellink($src), "\n";; | |||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | close(SLINK); | |||||||||||||||||||||||||||||||||||||||||
| 946 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | $ct->failm("$src: no such file or directory"); | |||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||
| 950 | my @candidates = sort $self->_lsprivate(1), | ||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | map { $_->{dst} } values %{$self->{ST_CI_FROM}}; | |||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | return if !@candidates; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 953 | # We'll be separating the elements-to-be into files and directories. | ||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | my(%files, @symlinks, %dirs); | |||||||||||||||||||||||||||||||||||||||||
| 955 | # If the parent directories of any of the candidates are | ||||||||||||||||||||||||||||||||||||||||||
| 956 | # already versioned, we'll need to check them out unless | ||||||||||||||||||||||||||||||||||||||||||
| 957 | # it's already been done. | ||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | my @dads = sort map {dirname($_)} @candidates; | |||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | my %lsd = map {split(/\s+Rule:\s+/, $_, 2)} | |||||||||||||||||||||||||||||||||||||||||
| 960 | $ct->argv('ls', [qw(-d -nxn -vis -vob)], @dads)->qx; | ||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | for my $dad (keys %lsd) { | |||||||||||||||||||||||||||||||||||||||||
| 962 | # If already checked out, nothing to do. | ||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | next if ! $lsd{$dad} || $lsd{$dad} =~ /CHECKEDOUT$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $lsd{$dad} or $lsd{$dad} =~ /CHECKEDOUT$/
MC/DC0%0/2
not $lsd{$dad} or $lsd{$dad} =~ /CHECKEDOUT$/
not $lsd{$dad}
$lsd{$dad} =~ /CHECKEDOUT$/
Truth table0%0/3
not(A) or B
A= not $lsd{$dad}B= $lsd{$dad} =~ /CHECKEDOUT$/
| |||||||||||||||||||||||||||||||||||||||||||
| 964 | # Now we know it's an element which needs to be checked out. | ||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | $dad =~ s%\\%/%g if MSWIN; | |||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | $dirs{$dad}++; | |||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | $self->branchco(1, keys %dirs) if keys %dirs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 969 | # Process candidate directories here, then do files below. | ||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | my $mkdir = $self->clone_ct->mkdir({autofail=>0, autochomp=>0}, | |||||||||||||||||||||||||||||||||||||||||
| 971 | $self->comment); | ||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | for my $cand (@candidates) { | |||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | ▶ | if (! -d $cand) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | ▶ | if ($cand =~ /$lext$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | push(@symlinks, $cand); | |||||||||||||||||||||||||||||||||||||||||
| 976 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | $files{$cand} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||||||||||||||||
| 981 | # Now we know we're dealing with directories. These cannot | ||||||||||||||||||||||||||||||||||||||||||
| 982 | # exist at mkelem time so we move them aside, make | ||||||||||||||||||||||||||||||||||||||||||
| 983 | # a versioned dir, then move all the files from the original | ||||||||||||||||||||||||||||||||||||||||||
| 984 | # back into the new dir (still as view-private files). | ||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my $tmpdir = "$cand.$$.keep.d"; | |||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | if (!rename($cand, $tmpdir)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | warn "$0: Error: can't rename '$cand' to '$tmpdir': $!\n"; | |||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | $ct->fail; | |||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | ▶ | if ($mkdir->args($cand)->system) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | ▶ | warn "Warning: unable to rename $tmpdir back to $cand!" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 993 | unless rename($tmpdir, $cand); | ||||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | $ct->fail; | |||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ▶ | if (!opendir(DIR, $tmpdir)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | warn "$0: Error: $tmpdir: $!"; | |||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | $ct->fail; | |||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | while (defined(my $i = readdir(DIR))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | ▶ | next if $i eq '.' || $i eq '..'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$i eq "." or $i eq ".."
MC/DC0%0/2
$i eq "." or $i eq ".."
$i eq "."
$i eq ".."
Truth table0%0/3
A or B
A= $i eq "."B= $i eq ".."
| |||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | ▶ | rename("$tmpdir/$i", "$cand/$i") || $self->failm("$cand/$i: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1005 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | closedir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | ▶ | rmdir $tmpdir || warn "$0: Error: $tmpdir: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | # Optionally, reconstitute an old element of the same name if present. | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | ▶ | if ($self->reuse) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | my $snapview = $self->snapdest; | |||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | my $ds = ClearCase::Argv->desc({stderr=>1}, [qw(-s)]); | |||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | my $dm = ClearCase::Argv->desc([qw(-fmt %m)]); | |||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | my $ln = ClearCase::Argv->ln; | |||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | my %reused; | |||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | for my $elem (keys %files) { | |||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | my($name, $dir) = fileparse($elem); | |||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | my $i = -1; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | DVER: | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | for (@{$self->vtree($dir)}) { | |||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | my $dirext = "$_/$name@@"; | |||||||||||||||||||||||||||||||||||||||||
| 1024 | # case-insensitive file test operator on Windows is a problem | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | ▶ | if ($snapview ? $ds->args($dirext)->qx !~ /Error:/ : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1026 | ecs("$_/$name")) { | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | next if $dm->args("$_/$name")->qx =~ /^directory /; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | ▶ | while (ccsymlink("$_/$name")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | $name = readcclink "$_/$name"; | |||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | $name =~ s/\@\@$//; | |||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | ▶ | next DVER if !ecs("$_/$name") || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ecs("$_/$name") or $dm->args("$_/$name")->qx =~ /^directory /
MC/DC0%0/2
not ecs("$_/$name") or $dm->args("$_/$name")->qx =~ /^directory /
not ecs("$_/$name")
$dm->args("$_/$name")->qx =~ /^directory /
Truth table0%0/3
not(A) or B
A= not ecs("$_/$name")B= $dm->args("$_/$name")->qx =~ /^directory /
| |||||||||||||||||||||||||||||||||||||||||||
| 1032 | $dm->args("$_/$name")->qx =~ /^directory /; | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | $reused{$elem} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | delete $files{$elem}; | |||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | unlink($elem); | |||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | $ln->args("$_/$name", $elem)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | $self->raise_dver($i, $dir); | |||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 1040 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | # If any elements were "reconstituted", they must be taken off the | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | # list of elems to be checked in explicitly, since 'ct ln' is | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | # just a directory op. | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | my %xkeys; | |||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | ▶ | if (!$self->no_cr && %reused) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->no_cr and %reused
MC/DC0%0/2
not $self->no_cr and %reused
not $self->no_cr
%reused
Truth table0%0/3
not(A) and B
A= not $self->no_crB= %reused
| |||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | for (keys %{$self->{ST_CI_FROM}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | ▶ | if (exists($self->{ST_CI_FROM}->{$_}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $self->{"ST_CI_FROM"}{$_} and exists $self->{"ST_CI_FROM"}{$_}{"dst"} and exists $reused{$self->{"ST_CI_FROM"}{$_}{"dst"}}
exists $self->{"ST_CI_FROM"}{$_} and exists $self->{"ST_CI_FROM"}{$_}{"dst"}
MC/DC0%0/3
exists $self->{"ST_CI_FROM"}{$_} and exists $self->{"ST_CI_FROM"}{$_}{"dst"} and exists $reused{$self->{"ST_CI_FROM"}{$_}{"dst"}}
exists $self->{"ST_CI_FROM"}{$_}
exists $self->{"ST_CI_FROM"}{$_}{"dst"}
exists $reused{$self->{"ST_CI_FROM"}{$_}{"dst"}}
Truth table0%0/4
A and B and C
A= exists $self->{"ST_CI_FROM"}{$_}B= exists $self->{"ST_CI_FROM"}{$_}{"dst"}C= exists $reused{$self->{"ST_CI_FROM"}{$_}{"dst"}}
| |||||||||||||||||||||||||||||||||||||||||||
| 1050 | && exists($self->{ST_CI_FROM}->{$_}->{dst}) | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | && exists($reused{$self->{ST_CI_FROM}->{$_}->{dst}})) { | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | $xkeys{$_} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1053 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | for (keys %xkeys) { | |||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | delete $self->{ST_CI_FROM}->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 1057 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | # Also, reconstituted elements may now be candidates for | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | # modification. Re-analyze the status for these. If any of | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | # them differ from their counterparts in the src area, copy | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | # them from the ADD list to the MOD list. | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | ▶ | my $comparator = $self->no_cmp ? undef : $self->cmp_func; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | for my $elem (keys %{$self->{ST_ADD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | if (exists($reused{$self->{ST_ADD}->{$elem}->{dst}})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | my $src = $self->{ST_ADD}->{$elem}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | my $dst = $self->{ST_ADD}->{$elem}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | ▶ | if ($self->_needs_update($src, $dst, $comparator)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | $self->{ST_MOD}->{$elem} = $self->{ST_ADD}->{$elem}; | |||||||||||||||||||||||||||||||||||||||||
| 1070 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | for (sort keys %{$self->{ST_CI_FROM}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | my $dst = $self->{ST_CI_FROM}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | ▶ | if ($files{$dst}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | my $src = $self->{ST_CI_FROM}->{$_}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | copy($src, $dst) || $ct->failm("$_: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | ▶ | utime(time(), (stat $src)[9], $dst) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1080 | warn "Warning: $dst: touch failed"; | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | # Now do the files in one fell swoop. | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | ▶ | $ct->mkelem($self->comment, sort keys %files)->system if %files; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||
| 1086 | # Deal with symlinks. | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | for my $symlink (@symlinks) { | |||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | (my $lnk = $symlink) =~ s/$lext$//; | |||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | ▶ | if (!open(SLINK, $symlink)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | warn "$symlink: $!"; | |||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | chomp(my $txt = <SLINK>); | |||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | close SLINK; | |||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | unlink $symlink; | |||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | $ct->ln(['-s'], $txt, $lnk)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1097 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | # Tried to use Cwd::abs_path, but it behaves differently on Cygwin and UNIX | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | sub absdst { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
absdst: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | my ($self, $dir, $f) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | ▶ | if ($f =~ /^\./) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | my $sep = qr{[/\\]}; | |||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | my @d = split $sep, $dir; | |||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | ▶ | while ($f =~ s/^(\.\.?$sep)//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | pop @d if $1 =~ /^\.{2}/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | $dir = join '/', @d; | |||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | return File::Spec->catfile($dir, $f); | |||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | ▶ | sub modify { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modify: not called CC=32 SCAR=69.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | ▶ | return if !keys %{$self->{ST_MOD}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | my(%files, %symlinks); | |||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | for (keys %{$self->{ST_MOD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | ▶ | if (src_slink($self->{ST_MOD}->{$_}->{src})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | $symlinks{$_}++; | |||||||||||||||||||||||||||||||||||||||||
| 1121 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | $files{$_}++; | |||||||||||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | my $rm = $self->clone_ct('rmname'); | |||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | my $ln = $self->clone_ct('ln'); | |||||||||||||||||||||||||||||||||||||||||
| 1127 | 0 | $ln->opts('-s', $ln->opts); | |||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | my $lsco = ClearCase::Argv->lsco([qw(-s -d -cview)]); | |||||||||||||||||||||||||||||||||||||||||
| 1129 | 0 | ▶ | my $comparator = $self->no_cmp ? undef : $self->cmp_func; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | if (keys %files) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | my (@toco, @del); | |||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | for my $key (sort keys %files) { | |||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | my $src = $self->{ST_MOD}->{$key}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | my $dst = $self->{ST_MOD}->{$key}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | my $new; | |||||||||||||||||||||||||||||||||||||||||
| 1136 | 0 | ▶ | if (ccsymlink($dst)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1137 | # The source is a file, but the destination is a symlink: look | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | # (recursively) at what this one points to, and link in this | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | # file. | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | # Build up the path of the destination, in such a way that it | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | # may be found, or not, in the hash. | ||||||||||||||||||||||||||||||||||||||||||
| 1142 | 0 | my $dangling; | |||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | my $sep = qr%[/\\]%; | |||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | my $dst1 = $dst; | |||||||||||||||||||||||||||||||||||||||||
| 1145 | 0 | ▶ | while (ccsymlink($dst1)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | my $tgt = readcclink $dst1; | |||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | my $dir = dirname $dst1; | |||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | ▶ | $tgt = $self->absdst($dir, $tgt) unless $tgt =~ m%^[/\\]%; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | $tgt =~ s%\\%/%g if MSWIN; | |||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | ▶ | if (-e $tgt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | $dst1 = $tgt; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | $dangling = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | 0 | my $dir = dirname($dst); | |||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | ▶ | $self->branchco(1, $dir) unless $lsco->args($dir)->qx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | $self->clone_ct->rm($dst)->system; #remove the first symlink | |||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | ▶ | if ($dangling || !$self->{ST_SUB}->{exfiles}->{$dst1}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dangling or not $self->{"ST_SUB"}{"exfiles"}{$dst1}
MC/DC0%0/2
$dangling or not $self->{"ST_SUB"}{"exfiles"}{$dst1}
$dangling
not $self->{"ST_SUB"}{"exfiles"}{$dst1}
Truth table0%0/3
A or not(B)
A= $danglingB= not $self->{"ST_SUB"}{"exfiles"}{$dst1}
| |||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | ▶ | if (!copy($src, $dst)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1162 | 0 | warn "$0: Error: $dst: $!\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | $rm->fail; | |||||||||||||||||||||||||||||||||||||||||
| 1164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | ▶ | utime(time(), (stat $src)[9], $dst) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1166 | warn "Warning: $dst: touch failed"; | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | $self->clone_ct->mkelem($self->comment, $dst)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1168 | 0 | $new = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | 0 | delete $self->{ST_MOD}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | push @del, $key; | |||||||||||||||||||||||||||||||||||||||||
| 1171 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | my $dir1 = dirname($dst1); | |||||||||||||||||||||||||||||||||||||||||
| 1173 | 0 | ▶ | $self->branchco(1, $dir1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dir eq $dir1 or $lsco->args($dir1)->qx
MC/DC0%0/2
$dir eq $dir1 or $lsco->args($dir1)->qx
$dir eq $dir1
$lsco->args($dir1)->qx
Truth table0%0/3
A or B
A= $dir eq $dir1B= $lsco->args($dir1)->qx
| |||||||||||||||||||||||||||||||||||||||||||
| 1174 | unless ($dir eq $dir1) || $lsco->args($dir1)->qx; | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | $self->clone_ct->mv($dst1, $dst)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1176 | 0 | delete $self->{ST_SUB}->{exfiles}->{$dst1}; #done already | |||||||||||||||||||||||||||||||||||||||||
| 1177 | 0 | ▶ | if (!$self->_needs_update($src, $dst, $comparator)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | delete $self->{ST_MOD}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | push @del, $key; | |||||||||||||||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | 0 | ▶ | push(@toco, $dst) unless exists($self->{ST_PRE}->{$dst}) || $new; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->{"ST_PRE"}{$dst} or $new
MC/DC0%0/2
exists $self->{"ST_PRE"}{$dst} or $new
exists $self->{"ST_PRE"}{$dst}
$new
Truth table0%0/3
A or B
A= exists $self->{"ST_PRE"}{$dst}B= $new
| |||||||||||||||||||||||||||||||||||||||||||
| 1184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | 0 | ▶ | $self->branchco(0, @toco) if @toco; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | delete @files{@del}; | |||||||||||||||||||||||||||||||||||||||||
| 1187 | 0 | for (sort keys %files) { | |||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | my $src = $self->{ST_MOD}->{$_}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1189 | 0 | my $dst = $self->{ST_MOD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1190 | 0 | ▶ | next if exists($self->{ST_PRE}->{$dst}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1191 | 0 | ▶ | if ($self->no_cr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1192 | 0 | ▶ | if (!copy($src, $dst)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | warn "$0: Error: $dst: $!\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | $rm->fail; | |||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | 0 | ▶ | utime(time(), (stat $src)[9], $dst) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1198 | warn "Warning: $dst: touch failed"; | ||||||||||||||||||||||||||||||||||||||||||
| 1199 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | $self->{ST_CI_FROM}->{$_} = $self->{ST_MOD}->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 1201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | if (keys %symlinks) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | my %checkedout = map {$_ => 1} $self->_lsco; | |||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | for (sort keys %symlinks) { | |||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | my $txt = $self->mkrellink($self->{ST_MOD}->{$_}->{src}); | |||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | my $lnk = $self->{ST_MOD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | my $dad = dirname($lnk); | |||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | ▶ | if (!$checkedout{$dad}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | ▶ | $checkedout{$dad} = 1 if ! $self->branchco(1, $dad); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | ▶ | if (!$rm->args($lnk)->system) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1214 | 0 | my @fil = grep /^\Q$lnk\E/, keys %{$self->{ST_SUB}->{exfiles}}; | |||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | delete @{$self->{ST_SUB}->{exfiles}}{@fil}; | |||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | delete $self->{ST_SUB}->{dirs}{$lnk}; | |||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | $ln->args($txt, $lnk)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | ▶ | sub subtract { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subtract: not called CC=20 SCAR=60.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1224 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | ▶ | return unless $self->{ST_SUB}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | my $ct = $self->clone_ct; | |||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | my %co = map {$_ => 1} $self->_lsco; | |||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | my $exnames = $self->{ST_SUB}->{exfiles}; # Entries to remove | |||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | my (%dir, %keep); # Directories respectively to inspect, and to keep | |||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | $dir{dirname($_)}++ for keys %{$exnames}; | |||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | $dir{$_}++ for keys %{$self->{ST_SUB}->{dirs}}; # Existed originally | |||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | my $dbase = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 1233 | 0 | for my $d (sort {$b cmp $a} keys %dir) { | |||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | ▶ | next if $keep{$d}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | my ($k) = ($d =~ m%^\Q$dbase\E/(.*)$%); | |||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | ▶ | if ($k and $self->{ST_SRCMAP}->{$k}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$k and $self->{"ST_SRCMAP"}{$k}
MC/DC0%0/2
$k and $self->{"ST_SRCMAP"}{$k}
$k
$self->{"ST_SRCMAP"}{$k}
Truth table0%0/3
A and B
A= $kB= $self->{"ST_SRCMAP"}{$k}
| |||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | delete $exnames->{$d}; | |||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | my $dad = $d; | |||||||||||||||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | $keep{$dad}++ while $dad = dirname($dad) and $dad gt $dbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dad = dirname($dad) and $dad gt $dbase
MC/DC0%0/2
$dad = dirname($dad) and $dad gt $dbase
$dad = dirname($dad)
$dad gt $dbase
Truth table0%0/3
A and B
A= $dad = dirname($dad)B= $dad gt $dbase
| |||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | 0 | ▶ | if (opendir(DIR, $d)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | my @entries = grep !/^\.\.?$/, readdir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | closedir(DIR); | |||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | map { $_ = join('/', $d, $_) } @entries; | |||||||||||||||||||||||||||||||||||||||||
| 1246 | 0 | ▶ | if (grep { !$exnames->{$_} and $ct->ls(['-s'], $_)->qx !~ /\@$/} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$exnames->{$_} || $ct->ls(['-s'], $_)->qx =~ /\@$/
MC/DC0%0/2
$exnames->{$_} || $ct->ls(['-s'], $_)->qx =~ /\@$/
$exnames->{$_}
$ct->ls(['-s'], $_)->qx =~ /\@$/
Truth table0%0/3
A || B
A= $exnames->{$_}B= $ct->ls(['-s'], $_)->qx =~ /\@$/
| |||||||||||||||||||||||||||||||||||||||||||
| 1247 | @entries) { # Something not to delete--some version selected | ||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | my $dad = $d; | |||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | ▶ | $keep{$dad}++ while $dad = dirname($dad) and $dad gt $dbase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dad = dirname($dad) and $dad gt $dbase
MC/DC0%0/2
$dad = dirname($dad) and $dad gt $dbase
$dad = dirname($dad)
$dad gt $dbase
Truth table0%0/3
A and B
A= $dad = dirname($dad)B= $dad gt $dbase
| |||||||||||||||||||||||||||||||||||||||||||
| 1250 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | ▶ | if (@entries) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | my @co = grep {$co{$_}} @entries; # Checkin before removing | |||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | ▶ | $ct->ci($self->comment, @co)->system if @co; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | delete @$exnames{@entries}; # Remove the contents | |||||||||||||||||||||||||||||||||||||||||
| 1255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | $exnames->{$d}++; # Add the container | |||||||||||||||||||||||||||||||||||||||||
| 1257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | delete @$exnames{keys %keep}; | |||||||||||||||||||||||||||||||||||||||||
| 1261 | 0 | my @exnames = keys %{$exnames}; | |||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | for my $dad (map {dirname($_)} @exnames) { | |||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | ▶ | $self->branchco(1, $dad) unless $co{$dad}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | # Force because of possible checkouts in other views. Fail for unreachable | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | ▶ | $ct->rm([@{$self->comment}, '-f'], @exnames)->system if @exnames; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | ▶ | sub label { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
label: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1270 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | ▶ | my $lbtype = shift || $self->lbtype; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $self->lbtype
MC/DC0%0/2
shift() || $self->lbtype
shift()
$self->lbtype
Truth table0%0/3
A || B
A= shift()B= $self->lbtype
| |||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | return unless $lbtype; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | my $dbase = $self->dstbase; | |||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | my $ct = $self->clone_ct({autochomp=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | my $ctq = $self->clone_ct({stdout=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 1276 | 0 | my $ctbool = $self->clone_ct({autofail=>0, stdout=>0, stderr=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 1277 | 0 | my $dvob = $self->dstvob; | |||||||||||||||||||||||||||||||||||||||||
| 1278 | 0 | my $locked; | |||||||||||||||||||||||||||||||||||||||||
| 1279 | 0 | ▶ | if ($ctbool->lstype(['-s'], "lbtype:$lbtype\@$dvob")->system) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1280 | 0 | $ct->mklbtype($self->comment, "lbtype:$lbtype\@$dvob")->system; | |||||||||||||||||||||||||||||||||||||||||
| 1281 | } elsif (!$self->inclb) { | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | $locked = $ct->lslock(['-s'], "lbtype:$lbtype\@$dvob")->qx; | |||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | ▶ | $ct->unlock("lbtype:$lbtype\@$dvob")->system if $locked; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | # Allow for labelling errors, in case of hard links: only the link | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | # recorded can be labelled, the other being seen as 'removed' | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | ▶ | if ($self->label_mods || $self->inclb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->label_mods or $self->inclb
MC/DC0%0/2
$self->label_mods or $self->inclb
$self->label_mods
$self->inclb
Truth table0%0/3
A or B
A= $self->label_modsB= $self->inclb
| |||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | my @mods = $self->_lsco; | |||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | ▶ | push @mods, @{$self->{ST_LBL}} if $self->{ST_LBL}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | ▶ | if (@mods) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1291 | 0 | ▶ | $ctbool->mklabel([qw(-nc -rep), $self->inclb], @mods)->system | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1292 | if $self->inclb; | ||||||||||||||||||||||||||||||||||||||||||
| 1293 | 0 | $ctbool->mklabel([qw(-nc -rep), $lbtype], @mods)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | my $lbl = $self->lblver; | |||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | ▶ | if ($lbl) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | my $ct = $self->clone_ct({autochomp=>1, autofail=>0, stderr=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 1299 | 0 | ▶ | my @rv = grep{ s/^(.*?)(?:@@(.*))/$1/ && | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
s/^(.*?)(?:\@@(.*))/$1/ && ($2 =~ /CHECKEDOUT$/ || !(-r "$_\@\@/$lbl"))
$2 =~ /CHECKEDOUT$/ or not -r "$_\@\@/$lbl"
MC/DC0%0/3
s/^(.*?)(?:\@@(.*))/$1/ && ($2 =~ /CHECKEDOUT$/ || !(-r "$_\@\@/$lbl"))
s/^(.*?)(?:\@@(.*))/$1/
$2 =~ /CHECKEDOUT$/
not -r "$_\@\@/$lbl"
Truth table0%0/4
A && B or not(C)
A= s/^(.*?)(?:\@@(.*))/$1/B= $2 =~ /CHECKEDOUT$/C= not -r "$_\@\@/$lbl"
| |||||||||||||||||||||||||||||||||||||||||||
| 1300 | ($2 =~ /CHECKEDOUT$/ || !-r "$_\@\@/$lbl") } | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | $ct->ls([qw(-r -vob -s)], $dbase)->qx, | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | $ct->ls([qw(-d -vob -s)], $dbase)->qx; | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | $ctbool->mklabel([qw(-nc -rep), $lbtype], $dbase, @rv)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1304 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | $ctbool->mklabel([qw(-nc -rep -rec), $lbtype], $dbase)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | # Possibly move the label back to the right versions | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | 0 | $ctbool->mklabel([qw(-nc -rep), $lbtype], @{$self->{ST_LBL}})->system | |||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | ▶ | if $self->{ST_LBL}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1310 | # Last, label the ancestors of the destination back to the vob tag. | ||||||||||||||||||||||||||||||||||||||||||
| 1311 | 0 | my($dad, @ancestors); | |||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | my $min = length($self->normalize($dvob)); | |||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | ▶ | for ($dad = dirname($dbase); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1314 | length($dad) >= $min; $dad = dirname($dad)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | 0 | push(@ancestors, $dad); | |||||||||||||||||||||||||||||||||||||||||
| 1316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | ▶ | $ctq->mklabel([qw(-rep -nc), $lbtype], @ancestors)->system | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1318 | if @ancestors; | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | ▶ | $self->clone_ct->lock("lbtype:$lbtype\@$dbase")->system if $locked; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | ▶ | sub get_addhash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_addhash: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1325 | 0 | ▶ | if ($self->{ST_ADD}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1326 | return | ||||||||||||||||||||||||||||||||||||||||||
| 1327 | 0 | map { $self->{ST_ADD}->{$_}->{src}, $self->{ST_ADD}->{$_}->{dst} } | |||||||||||||||||||||||||||||||||||||||||
| 1328 | 0 | keys %{$self->{ST_ADD}}; | |||||||||||||||||||||||||||||||||||||||||
| 1329 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | ▶ | sub get_modhash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_modhash: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | ▶ | if ($self->{ST_MOD}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1337 | return | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | 0 | map { $self->{ST_MOD}->{$_}->{src}, $self->{ST_MOD}->{$_}->{dst} } | |||||||||||||||||||||||||||||||||||||||||
| 1339 | 0 | keys %{$self->{ST_MOD}}; | |||||||||||||||||||||||||||||||||||||||||
| 1340 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 1342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||
| 1345 | 0 | ▶ | sub get_sublist { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sublist: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1346 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1347 | 0 | ▶ | if ($self->{ST_SUB}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1348 | 0 | return sort keys %{$self->{ST_SUB}->{exfiles}}; | |||||||||||||||||||||||||||||||||||||||||
| 1349 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 1351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||
| 1354 | 0 | ▶ | sub checkin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkin: not called CC=20 SCAR=60.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | my $mbase = $self->_mkbase; | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | my $dad = dirname($mbase); | |||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | ▶ | my @ptime = qw(-pti) unless $self->ctime; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1359 | 0 | my @cmnt = @{$self->comment}; | |||||||||||||||||||||||||||||||||||||||||
| 1360 | 0 | my $ct = $self->clone_ct({autochomp=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 1361 | # If special eltypes are registered, chtype them here. | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | 0 | ▶ | if (my %emap = $self->eltypemap) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | for my $re (keys %emap) { | |||||||||||||||||||||||||||||||||||||||||
| 1364 | 0 | my @chtypes = grep {/$re/} map {$self->{ST_ADD}->{$_}->{dst}} | |||||||||||||||||||||||||||||||||||||||||
| 1365 | 0 | keys %{$self->{ST_ADD}}; | |||||||||||||||||||||||||||||||||||||||||
| 1366 | 0 | ▶ | next unless @chtypes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1367 | 0 | $ct->chtype([@cmnt, '-f', $emap{$re}], @chtypes)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | # Do one-by-one ci's with -from (to preserve CR's) unless | ||||||||||||||||||||||||||||||||||||||||||
| 1371 | # otherwise requested. | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | ▶ | if (! $self->no_cr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | for (keys %{$self->{ST_CI_FROM}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | my $src = $self->{ST_CI_FROM}->{$_}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | my $dst = $self->{ST_CI_FROM}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | $ct->ci([@ptime, @cmnt, qw(-ide -rm -from), $src], $dst)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | delete @{$self->{ST_MOD}}{keys %{$self->{ST_CI_FROM}}}; | |||||||||||||||||||||||||||||||||||||||||
| 1379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1380 | # Check-in first the files modified under the recorded names, | ||||||||||||||||||||||||||||||||||||||||||
| 1381 | # in case of hardlinks, since checking the other link first | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | # in a pair would fail. | ||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | my @mods; | |||||||||||||||||||||||||||||||||||||||||
| 1384 | 0 | push @mods, $self->{ST_MOD}->{$_}->{dst} for | |||||||||||||||||||||||||||||||||||||||||
| 1385 | 0 | grep {!ccsymlink($self->{ST_MOD}->{$_}->{dst})} keys %{$self->{ST_MOD}}; | |||||||||||||||||||||||||||||||||||||||||
| 1386 | 0 | ▶ | $ct->ci([@cmnt, '-ide', @ptime], sort @mods)->system if @mods; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1387 | # Check in anything not handled above. | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | my %checkedout = map {$_ => 1} $self->_lsco; | |||||||||||||||||||||||||||||||||||||||||
| 1389 | 0 | my @todo = grep {m%^\Q$mbase%} keys %checkedout; | |||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | ▶ | @todo = grep {!exists($self->{ST_PRE}->{$_})} @todo if $self->ignore_co; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | ▶ | unshift(@todo, $dad) if $checkedout{$dad}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1392 | # Sort reverse in case the checked in versions are not selected by the view | ||||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | ▶ | $ct->argv('ci', [@cmnt, '-ide', @ptime], sort {$b cmp $a} @todo)->system | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1394 | if @todo; | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | # Fix the protections of the target files if requested. Unix files | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | # get careful consideration of bitmasks etc; Windows files just get | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | # promoted to a+x if their extension looks executable. | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | 0 | ▶ | if ($self->protect) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1399 | 0 | if (MSWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 1400 | my @exes; | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | for (keys %{$self->{ST_ADD}}) { | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | next unless m%\.(bat|cmd|exe|dll|com|cgi|.?sh|pl)$%i; | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | push(@exes, $self->{ST_ADD}->{$_}->{dst}); | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | $ct->argv('protect', [qw(-chmod a+x)], @exes)->system if @exes; | ||||||||||||||||||||||||||||||||||||||||||
| 1406 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | my %perms; | |||||||||||||||||||||||||||||||||||||||||
| 1408 | 0 | for (keys %{$self->{ST_ADD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1409 | 0 | my $src = $self->{ST_ADD}->{$_}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | my $dst = $self->{ST_ADD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | my $src_mode = (stat $src)[2]; | |||||||||||||||||||||||||||||||||||||||||
| 1412 | 0 | my $dst_mode = (stat $dst)[2]; | |||||||||||||||||||||||||||||||||||||||||
| 1413 | # 07551 represents the only bits that matter to clearcase | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | 0 | ▶ | if (($src_mode & 07551) ne ($dst_mode & 07551) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
($src_mode & 3945) ne ($dst_mode & 3945) and not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
MC/DC0%0/2
($src_mode & 3945) ne ($dst_mode & 3945) and not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
($src_mode & 3945) ne ($dst_mode & 3945)
not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
Truth table0%0/3
A and not(B)
A= ($src_mode & 3945) ne ($dst_mode & 3945)B= not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
| |||||||||||||||||||||||||||||||||||||||||||
| 1415 | $src !~ m%\.(?:p|html?|gif|mak|rc|ini|java| | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | c|cpp|cxx|h|bmp|ico)$|akefile%x) { | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | 0 | my $sym = sprintf("%o", ($src_mode & 07775) | 0444); | |||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | push(@${$perms{$sym}}, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 1419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | 0 | for (keys %{$self->{ST_MOD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | my $src = $self->{ST_MOD}->{$_}->{src}; | |||||||||||||||||||||||||||||||||||||||||
| 1423 | 0 | my $dst = $self->{ST_MOD}->{$_}->{dst}; | |||||||||||||||||||||||||||||||||||||||||
| 1424 | 0 | my $src_mode = (stat $src)[2]; | |||||||||||||||||||||||||||||||||||||||||
| 1425 | 0 | my $dst_mode = (stat $dst)[2]; | |||||||||||||||||||||||||||||||||||||||||
| 1426 | # 07551 represents the only bits that matter to clearcase | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | 0 | ▶ | if (($src_mode & 07551) ne ($dst_mode & 07551) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
($src_mode & 3945) ne ($dst_mode & 3945) and not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
MC/DC0%0/2
($src_mode & 3945) ne ($dst_mode & 3945) and not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
($src_mode & 3945) ne ($dst_mode & 3945)
not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
Truth table0%0/3
A and not(B)
A= ($src_mode & 3945) ne ($dst_mode & 3945)B= not $src =~ /\.(?:p|html?|gif|mak|rc|ini|java|
c|cpp|cxx|h|bmp|ico)$|akefile/x
| |||||||||||||||||||||||||||||||||||||||||||
| 1428 | $src !~ m%\.(?:p|html?|gif|mak|rc|ini|java| | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | c|cpp|cxx|h|bmp|ico)$|akefile%x) { | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | 0 | my $sym = sprintf("%o", ($src_mode & 07775) | 0444); | |||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | push(@${$perms{$sym}}, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | 0 | for (keys %perms) { | |||||||||||||||||||||||||||||||||||||||||
| 1435 | 0 | $ct->argv('protect', ['-chmod', $_], @${$perms{$_}})->system; | |||||||||||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||
| 1441 | 0 | ▶ | sub cleanup { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1442 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1443 | 0 | my $mbase = $self->_mkbase; | |||||||||||||||||||||||||||||||||||||||||
| 1444 | 0 | my $dad = dirname($mbase); | |||||||||||||||||||||||||||||||||||||||||
| 1445 | 0 | my $ct = $self->clone_ct({autofail=>0}); | |||||||||||||||||||||||||||||||||||||||||
| 1446 | 0 | my @vp = $self->_lsprivate(1); | |||||||||||||||||||||||||||||||||||||||||
| 1447 | 0 | for (sort {$b cmp $a} @vp) { | |||||||||||||||||||||||||||||||||||||||||
| 1448 | 0 | ▶ | if (-d $_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1449 | 0 | ▶ | rmdir $_ || warn "$0: Error: unable to remove $_\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1450 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1451 | 0 | ▶ | unlink $_ || warn "$0: Error: unable to remove $_\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$_ || warn("$0: Error: unable to remove $_\n")
MC/DC0%0/1
$_ || warn("$0: Error: unable to remove $_\n")
$_
Truth table0%0/2
A
A= $_
| |||||||||||||||||||||||||||||||||||||||||||
| 1452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1454 | 0 | my %checkedout = map {$_ => 1} $self->_lsco; | |||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | my @todo = grep {m%^\Q$mbase%} keys %checkedout; | |||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | ▶ | @todo = grep {!exists($self->{ST_PRE}->{$_})} @todo | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->ignore_co or $self->overwrite_co
MC/DC0%0/2
$self->ignore_co or $self->overwrite_co
$self->ignore_co
$self->overwrite_co
Truth table0%0/3
A or B
A= $self->ignore_coB= $self->overwrite_co
| |||||||||||||||||||||||||||||||||||||||||||
| 1457 | if $self->ignore_co || $self->overwrite_co; | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | 0 | ▶ | unshift(@todo, $dad) if $checkedout{$dad}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | ▶ | if ($self->{branchoffroot}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1460 | 0 | for (sort {$b cmp $a} @todo) { | |||||||||||||||||||||||||||||||||||||||||
| 1461 | 0 | my $b = $ct->ls([qw(-s -d)], $_)->qx; | |||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | $ct->unco([qw(-rm)], $_)->system; | |||||||||||||||||||||||||||||||||||||||||
| 1463 | 0 | ▶ | if ($b =~ s%^(.*)[\\/]CHECKEDOUT$%$1%) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1464 | 0 | ▶ | opendir BR, $b or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1465 | 0 | my @f = grep !/^(\.\.?|0|LATEST)$/, readdir BR; | |||||||||||||||||||||||||||||||||||||||||
| 1466 | 0 | closedir BR; | |||||||||||||||||||||||||||||||||||||||||
| 1467 | 0 | ▶ | $ct->rmbranch([qw(-f)], $b)->system unless @f; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | 0 | ▶ | $ct->unco([qw(-rm)], sort {$b cmp $a} @todo)->system if @todo; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||
| 1475 | # Undo current work and exit. May be called from an exception handler. | ||||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | ▶ | sub fail { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fail: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1477 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | my $rc = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1479 | 0 | $self->ct->autofail(0); # avoid exception-handler loop | |||||||||||||||||||||||||||||||||||||||||
| 1480 | 0 | $self->cleanup; | |||||||||||||||||||||||||||||||||||||||||
| 1481 | 0 | ▶ | exit(defined($rc) ? $rc : 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||||||||||||
| 1484 | 0 | ▶ | sub failm { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
failm: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1485 | 0 | my ($self, $msg, $rc) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1486 | 0 | warn "$0: Error: $msg\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1487 | 0 | $self->fail($rc); | |||||||||||||||||||||||||||||||||||||||||
| 1488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||
| 1490 | 0 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1491 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1492 | 0 | return $ClearCase::SyncTree::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 1493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | # Here 'ecs' means Exists Case Sensitive. We don't generally | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | # want the case-insensitive file test operators on Windows. | ||||||||||||||||||||||||||||||||||||||||||
| 1497 | # The underlying problem is that cleartool is always case | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | # sensitive. I.e. you can mkelem 'Foo' and then open 'foo' | ||||||||||||||||||||||||||||||||||||||||||
| 1499 | # if you have the right MVFS settings, but you cannot check | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | # out or describe 'foo', only 'Foo'. | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | # This could lead to other problems on Windows though, since you | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | # may create evil twins if you subtract an old name and | ||||||||||||||||||||||||||||||||||||||||||
| 1503 | # then add it under a name which differs only by case. But at | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | # least that does work, whereas trying to checkout a path | ||||||||||||||||||||||||||||||||||||||||||
| 1505 | # with the wrong case does not work at all. Let the evil twin | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | # trigger handle the evil twin scenario. | ||||||||||||||||||||||||||||||||||||||||||
| 1507 | 0 | ▶ | sub ecs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ecs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1508 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1509 | 0 | my $rc = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1510 | 0 | if (MSWIN || CYGWIN) { | |||||||||||||||||||||||||||||||||||||||||
| 1511 | if (opendir DIR, dirname($file)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | my $match = basename($file); | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | # Faster than for/last when not found! | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | $rc = 1 if grep {$_ eq $match} readdir DIR; | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | closedir DIR; | ||||||||||||||||||||||||||||||||||||||||||
| 1516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | 0 | $rc = -e $file; | |||||||||||||||||||||||||||||||||||||||||
| 1519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1520 | 0 | return $rc; | |||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||
| 1523 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | __END__ | ||||||||||||||||||||||||||||||||||||||||||