Branch Coverage

blib/lib/File/Rsync/Mirror/Recentfile.pm
Criterion Covered Total %
branch 295 486 60.7


line true false branch
117 542 0 unless (defined $self->protocol)
120 517 25 unless (defined $self->filenameroot)
123 522 20 unless (defined $self->serializer_suffix)
140 0 1109 unless open my $fh, $file
150 0 31 if ($symlink =~ m[/])
158 0 1109 unless $suffix
160 1109 0 if ($suffix eq '.yaml') { }
0 0 elsif ($HAVE->{'Data::Serializer'}) { }
171 1109 10901 if $k ne lc $k
174 0 1109 unless (defined $self->protocol)
188 5194 4 unless ($self->_current_tempfile_fh)
189 119 5075 if (my $tempfile = $self->_current_tempfile)
190 19 100 if (-e $tempfile)
413 1870 0 if not $seen_interval{$_->{'interval'}}++
415 0 354 unless $self->aggregator
423 606 380 if ($option{'force'} or $i == 0) { }
427 320 60 if (-e $next_rfile) { }
431 55 265 if ($next_age > $prev->interval_secs)
438 721 265 if ($want_merge) { }
452 0 30 unless $self->aggregator
476 1646 0 if ($File::Rsync::Mirror::Recentfile::Config{'d_symlink'} eq 'define') { }
478 1625 21 if (-l $recentrecentfile) { }
480 1610 15 if ($found_symlink eq $self->rfilename) { }
488 21 15 if (1 == $howto_create_symlink) { }
489 0 21 unless symlink $self->rfilename, $recentrecentfile
492 0 15 unless symlink $self->rfilename, "$recentrecentfile.$$"
493 0 15 unless rename "$recentrecentfile.$$", $recentrecentfile
498 0 0 unless cp($self->rfilename, "$recentrecentfile.$$")
499 0 0 unless rename "$recentrecentfile.$$", $recentrecentfile
514 15 26 unless (defined $x)
536 15 104 if (not $done) { }
10 94 elsif (not &blessed($done)) { }
566 43 31 if ($self->_use_tempfile) { }
567 10 33 if ($self->ttl_reached) { }
578 0 41 if ($fh) { }
585 27 14 if (defined $rfile and -e $rfile)
588 0 27 unless cp($rfile, $dst)
595 0 41 if ($self->verbose)
596 0 0 -e $dst ? :
616 0 0 if (++$retried >= 3)
622 0 41 if ($gaveup) { }
631 0 41 if ($self->verbose)
636 0 41 unless chmod $mode, $dst
643 21 20 if defined $tempdir
644 20 0 unless ($tempdir = $self->tempdir)
647 0 20 unless (-d $tempdir)
667 0 41 unless chmod $mode, $dst
668 10 31 if ($self->_use_tempfile)
677 0 0 if (my $vl = $self->verboselog) { }
678 0 0 unless open $fh, '>>', $vl
703 0 0 if ($self->verbose)
704 0 0 -e $dst ? :
716 0 0 unless my $remoteroot = $self->remoteroot
726 0 0 if ($self->verbose)
742 5060 67249 if (@_ >= 2)
747 1 72308 unless (defined $interval)
765 0 26086 unless (defined $interval)
768 1 26085 unless my($n, $t) = $interval =~ /^(\d*)([smhdWMQYZ]$)/
770 961 25124 if ($interval eq 'Z') { }
25124 0 elsif (exists $seconds{$t} and $n =~ /^\d+$/) { }
788 1663 9880 if (@_ >= 2)
808 0 1486 unless (defined $path)
827 0 3088 if my $locked = $self->_is_locked
836 0 0 if (open my $fh, '<', $procfile) { }
838 0 0 if (do { not $process =~ /^\d+$/ }) { }
0 0 elsif ($$ == $process) { }
0 0 elsif (kill 0, $process) { }
840 0 0 unless $have_warned{'unknown'}++
844 0 0 unless $have_warned{$process}++
851 0 0 unless $have_warned{'unknown'}++
854 0 0 if (time - $start > $locktimeout)
858 0 3088 unless open my $fh, '>', $procfile
860 0 3088 unless close $fh
893 646 75 $my_recent->[0] ? :
894 721 0 $other_recent->[0] ? :
897 75 646 unless ($my_recent->[0])
901 721 0 if ($epoch)
902 233 488 if (($other->dirtymark || 0) ne ($self->dirtymark || 0)) { }
446 42 elsif (my $merged = $self->merged) { }
908 0 446 if (@$other_recent and &_bigfloatlt($other_recent->[-1]{'epoch'}, $oldest_allowed))
924 0 24436 if &_bigfloatlt($oevepoch, $oldest_allowed)
926 0 24436 if $have_path{$path}++
927 27 24409 if ($self->interval eq 'Z' and $oev->{'type'} eq 'delete' and not $self->keep_delete_objects_forever) { }
933 4725 19684 if (not $myepoch or &_bigfloatgt($oevepoch, $myepoch))
939 679 42 if ($something_done)
951 23355 31851 if (not @$my_recent or @$other_recent_filtered and &_bigfloatge($other_recent_filtered->[0]{'epoch'}, $my_recent->[0]{'epoch'})) { }
956 18552 13299 if $$have_path{$event->{'path'}}++
958 10 36644 if defined $last_epoch and $event->{'epoch'} eq $last_epoch
962 10 669 if ($epoch_conflict)
966 10 260 if ($have_epoch{$epoch}++)
975 233 446 if (not $self->dirtymark or $other->dirtymark ne $self->dirtymark)
989 0 721 if ($self->interval_secs <= $other->interval_secs)
1010 4542 9961 if (defined $set)
1015 9421 707 if ($merged and $into = $merged->{'into_interval'} and defined $self->_interval)
1017 0 9421 if ($into eq $self->interval) { }
0 9421 elsif ($self->interval_secs($into) < $self->interval_secs) { }
1062 23322 3798 if (defined $v)
1116 26 2706 if $i == $last_item
1117 6 2700 if ($status->{'mustreturn'})
1118 5 1 if ($self->_current_tempfile and not $self->_current_tempfile_fh)
1121 0 5 unless unlink $t
1128 17 9 if (@dlcollector)
1130 0 17 if (not $success or $@)
1136 0 26 if ($self->verbose)
1160 1246 1486 if $done->covered($recent_event->{'epoch'})
1161 826 660 if ($pathdb)
1163 271 0 if ($rec and $rec->{'recentepoch'})
1164 0 271 if (&_bigfloatgt($rec->{'recentepoch'}, $recent_event->{'epoch'}))
1172 1462 24 if ($recent_event->{'type'} eq 'new') { }
24 0 elsif ($recent_event->{'type'} eq 'delete') { }
1188 0 24 if ($options->{'skip-deletes'}) { }
1192 9 15 if (not -e _) { }
15 0 elsif (-l _ or not -d _) { }
1203 9 15 if ($pathdb)
1224 0 1462 if ($self->verbose)
1225 0 0 -e $dst ? :
1240 0 1462 if ($self->verbose)
1245 11 1451 if (@$dlcollector >= $max_files_per_connection) { }
1248 11 0 unless defined $sleep
1250 6 5 if ($options->{'piecemeal'})
1257 0 5 if (not $success or $@)
1262 0 5 if ($self->verbose)
1271 18 10 if ($pathdb)
1294 26 0 if (rename $trecentfile, $rfile) { }
1301 10 16 if (my $ctfh = $self->_current_tempfile_fh)
1311 15 15 unless (unlink $dst)
1313 0 15 if $options->{'verbose'}
1315 0 30 if ($self->verbose)
1330 0 0 unless (rmdir $dst)
1332 0 0 if $options->{'verbose'}
1334 0 0 if ($self->verbose)
1369 28 0 if (ref $path and ref $path eq 'ARRAY') { }
1395 0 0 if ($self->_my_ignore_link_stat_errors and join($", @err) =~ /^ rsync: \s link_stat /x)
1396 0 0 if ($self->verbose)
1403 0 0 if (++$retried >= 3)
1411 28 0 unless ($gaveup)
1427 0 0 if ($self->_my_ignore_link_stat_errors and join($", @err) =~ /^ rsync: \s link_stat /x)
1428 0 0 if ($self->verbose)
1444 0 0 unless defined $x
1451 33 6586 if ($self->_use_tempfile)
1454 6586 33 unless ($rfile and -s $rfile)
1523 37 6560 if ($self->is_slave)
1527 0 6597 unless my $rfile_or_tempfile = $self->_my_current_rfile
1528 110 6487 unless -e $rfile_or_tempfile
1538 0 6487 if ($err or not $data)
1542 0 6487 if (&reftype($data) eq 'ARRAY') { }
1551 4482 2005 unless grep {defined $options{$_};} 'after', 'before', 'contains', 'max', 'skip-deletes'
1560 2000 5 if ($info)
1564 5 2000 if (defined $options->{'after'})
1565 5 0 if ($re->[0]{'epoch'} > $options->{'after'}) { }
1566 5 0 if (my $f = &first(sub { $re->[$_]{'epoch'} <= $options->{'after'}; } , 0 .. $#$re))
1578 2000 5 if (defined $options->{'before'})
1579 1855 145 if ($re->[0]{'epoch'} > $options->{'before'}) { }
1580 570 1285 if (my $f = &first(sub { $re->[$_]{'epoch'} < $options->{'before'}; } , 0 .. $last_item))
1591 2005 0 if (0 != $first_item or -1 != $last_item)
1594 0 2005 if ($options->{'skip-deletes'})
1597 0 2005 if (my $contopt = $options->{'contains'})
1600 0 0 if (exists $contopt->{$allow})
1606 0 0 if (keys %$contopt > $seen_allowed)
1612 0 2005 if ($options->{'max'} and @$re > $options->{'max'})
1626 6487 55481 if ($k ne lc $k)
1630 45021 10460 if defined $self->$k
1635 6487 0 if (my(@stat) = stat $rfile_or_tempfile) { }
1651 6487 0 if (@$re)
1664 6487 0 if ($suffix eq '.yaml') { }
0 0 elsif ($HAVE->{'Data::Serializer'}) { }
1672 0 0 unless open my $fh, $rfile_or_tempfile
1694 5 18 if ($old_dirtymark and $new_dirtymark and $new_dirtymark ne $old_dirtymark)
1727 5 10 if (defined $set)
1747 14 69 if (defined $set)
1751 5 78 unless (defined $remoteroot)
1752 0 5 defined $self->remote_host ? :
0 5 defined $self->remote_module ? :
5 0 defined $self->remote_dir ? :
1783 5 0 if (my($f, $i, $s) = $rfname =~ /$splitter/) { }
1802 11121 4980 if defined $rfile
1821 26 43 unless (defined $rsync)
1823 26 0 if ($HAVE->{'File::Rsync'}) { }
1853 0 0 unless defined $max_rsync_errors
1854 0 0 if ($max_rsync_errors >= 0 and $no_success_count >= $max_rsync_errors)
1867 0 0 if $sleep > 300
1918 3312 48304 if ref $o
1933 43 0 unless defined $ttl
1934 10 33 if ($now > $have_mirrored + $ttl)
1949 5198 3088 unless $self->_is_locked
1951 0 3088 unless unlink "$rfile.lock/process"
1952 0 3088 unless rmdir "$rfile.lock"
2003 35 1579 unless @$recent
2004 1414 165 if (&_bigfloatgt('' . $epoch, $recent->[0]{'epoch'})) { }
2012 0 354 if (defined $path or defined $type or defined $dirty_epoch)
2013 0 1292 unless defined $path
2014 0 1292 unless defined $type
2015 0 1292 unless $type =~ /(new|delete)/
2019 1339 307 if $ctx->{'something_done'}
2042 0 0 if $ctx->{'something_done'}
2050 35 1611 unless ($recent->[0])
2057 390 1256 unless ($canonmeth)
2063 0 1646 if ($self->verbose and @$batch > 1)
2065 0 0 if $@
2075 0 1646 if $console and not $i % 50
2083 0 1646 if $console
2084 32 1614 if ($setting_new_dirty_mark)
2088 1004 1646 if (&_bigfloatlt($recent->[-1]{'epoch'}, $oldest_allowed)) { }
2100 0 354 if (defined $path or defined $type or defined $dirty_epoch)
2107 32 1614 if (defined $dirty_epoch and &_bigfloatgt($now, $dirty_epoch)) { }
2114 877 769 if ($merged->{'epoch'} and not $setting_new_dirty_mark) { }
2123 1292 354 if (defined $path and $path =~ s/^\Q$lrd\E//)
2127 32 1260 if (defined $dirty_epoch) { }
2134 0 32 if (&_bigfloatgt($epoch, $now))
2139 32 0 if (not defined $merged->{'epoch'} or &_bigfloatlt($epoch, $merged->{'epoch'}))
2146 1292 0 if (defined $splicepos)
2166 0 32 if (exists $paths_in_recent->{$path})
2169 0 0 if ($recent->[$i]{'path'} eq $path) { }
2170 0 0 if ($recent->[$i]{'epoch'} eq $epoch)
2179 0 0 unless $cancel
2181 0 32 if (not exists $recent->[0] or &_bigfloatgt($epoch, $recent->[0]{'epoch'})) { }
32 0 elsif (&_bigfloatlt($epoch, $recent->[-1]{'epoch'})) { }
2187 0 0 if (&_bigfloatgt(scalar($memo_splicepos <= $#$recent && $epoch), $recent->[$memo_splicepos]{'epoch'})) { }
2194 0 0 if ($epoch eq $recent->[$i]{'epoch'})
2195 0 0 $i ? :
2197 0 0 if (&_bigfloatgt($epoch, $recent->[$i]{'epoch'}))
2228 95 39 if (defined $set)
2232 8 126 unless (defined $x)
2249 19 37 if ($self->_uptodateness_ever_reached and not $self->seeded)
2261 37 19 unless (defined $uptodate)
2264 21 16 if (exists $minmax->{'mtime'})
2267 21 0 if (@stat) { }
2269 0 21 if (defined $mtime and defined $minmax->{'mtime'} and $mtime > $minmax->{'mtime'}) { }
2274 21 0 defined $covered ? :
2285 16 40 unless (defined $uptodate)
2289 34 22 if ($uptodate)
2314 0 2712 unless defined $recent
2317 0 108413 if (defined $Last_epoch and &_bigfloatge($recent->[$i]{'epoch'}, $Last_epoch))
2328 1668 1044 if (not defined $minmax->{'max'} or &_bigfloatlt($minmax->{'max'}, $recent->[0]{'epoch'}))
2329 1668 0 @$recent && exists $recent->[0]{'epoch'} ? :
2331 563 2149 if (not defined $minmax->{'min'} or &_bigfloatlt($minmax->{'min'}, $recent->[-1]{'epoch'}))
2332 563 0 @$recent && exists $recent->[-1]{'epoch'} ? :
2349 0 0 unless rename "$rfile.new", $rfile
2367 2697 15 if ($suffix eq '.yaml') { }
15 0 elsif ($HAVE->{'Data::Serializer'}) { }
2376 0 2712 unless open my $fh, '>', "$rfile.new"
2378 0 2712 unless close $fh
2379 0 2712 unless rename "$rfile.new", $rfile