Branch Coverage

blib/lib/File/Rsync/Mirror/Recentfile.pm
Criterion Covered Total %
branch 293 484 60.5


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)
535 15 104 unless ($done)
562 43 31 if ($self->_use_tempfile) { }
563 10 33 if ($self->ttl_reached) { }
574 0 41 if ($fh) { }
581 27 14 if (defined $rfile and -e $rfile)
584 0 27 unless cp($rfile, $dst)
591 0 41 if ($self->verbose)
592 0 0 -e $dst ? :
612 0 0 if (++$retried >= 3)
618 0 41 if ($gaveup) { }
627 0 41 if ($self->verbose)
632 0 41 unless chmod $mode, $dst
639 21 20 if defined $tempdir
640 20 0 unless ($tempdir = $self->tempdir)
643 0 20 unless (-d $tempdir)
663 0 41 unless chmod $mode, $dst
664 10 31 if ($self->_use_tempfile)
673 0 0 if (my $vl = $self->verboselog) { }
674 0 0 unless open $fh, '>>', $vl
699 0 0 if ($self->verbose)
700 0 0 -e $dst ? :
712 0 0 unless my $remoteroot = $self->remoteroot
722 0 0 if ($self->verbose)
738 5060 64839 if (@_ >= 2)
743 1 69898 unless (defined $interval)
761 0 26038 unless (defined $interval)
764 1 26037 unless my($n, $t) = $interval =~ /^(\d*)([smhdWMQYZ]$)/
766 961 25076 if ($interval eq 'Z') { }
25076 0 elsif (exists $seconds{$t} and $n =~ /^\d+$/) { }
784 1663 9829 if (@_ >= 2)
804 0 1435 unless (defined $path)
823 0 3088 if my $locked = $self->_is_locked
832 0 0 if (open my $fh, '<', $procfile) { }
834 0 0 if (do { not $process =~ /^\d+$/ }) { }
0 0 elsif ($$ == $process) { }
0 0 elsif (kill 0, $process) { }
836 0 0 unless $have_warned{'unknown'}++
840 0 0 unless $have_warned{$process}++
847 0 0 unless $have_warned{'unknown'}++
850 0 0 if (time - $start > $locktimeout)
854 0 3088 unless open my $fh, '>', $procfile
856 0 3088 unless close $fh
889 646 75 $my_recent->[0] ? :
890 721 0 $other_recent->[0] ? :
893 75 646 unless ($my_recent->[0])
897 721 0 if ($epoch)
898 233 488 if (($other->dirtymark || 0) ne ($self->dirtymark || 0)) { }
446 42 elsif (my $merged = $self->merged) { }
904 0 446 if (@$other_recent and &_bigfloatlt($other_recent->[-1]{'epoch'}, $oldest_allowed))
920 0 22079 if &_bigfloatlt($oevepoch, $oldest_allowed)
922 0 22079 if $have_path{$path}++
923 27 22052 if ($self->interval eq 'Z' and $oev->{'type'} eq 'delete' and not $self->keep_delete_objects_forever) { }
929 4697 17355 if (not $myepoch or &_bigfloatgt($oevepoch, $myepoch))
935 679 42 if ($something_done)
947 20998 28102 if (not @$my_recent or @$other_recent_filtered and &_bigfloatge($other_recent_filtered->[0]{'epoch'}, $my_recent->[0]{'epoch'})) { }
952 16243 11859 if $$have_path{$event->{'path'}}++
954 10 32847 if defined $last_epoch and $event->{'epoch'} eq $last_epoch
958 10 669 if ($epoch_conflict)
962 10 260 if ($have_epoch{$epoch}++)
971 233 446 if (not $self->dirtymark or $other->dirtymark ne $self->dirtymark)
985 0 721 if ($self->interval_secs <= $other->interval_secs)
1006 4542 9956 if (defined $set)
1011 9397 726 if ($merged and $into = $merged->{'into_interval'} and defined $self->_interval)
1013 0 9397 if ($into eq $self->interval) { }
0 9397 elsif ($self->interval_secs($into) < $self->interval_secs) { }
1058 23272 3798 if (defined $v)
1112 26 2615 if $i == $last_item
1113 6 2609 if ($status->{'mustreturn'})
1114 5 1 if ($self->_current_tempfile and not $self->_current_tempfile_fh)
1117 0 5 unless unlink $t
1124 17 9 if (@dlcollector)
1126 0 17 if (not $success or $@)
1132 0 26 if ($self->verbose)
1156 1206 1435 if $done->covered($recent_event->{'epoch'})
1157 815 620 if ($pathdb)
1159 260 0 if ($rec and $rec->{'recentepoch'})
1160 0 260 if (&_bigfloatgt($rec->{'recentepoch'}, $recent_event->{'epoch'}))
1168 1411 24 if ($recent_event->{'type'} eq 'new') { }
24 0 elsif ($recent_event->{'type'} eq 'delete') { }
1184 0 24 if ($options->{'skip-deletes'}) { }
1188 9 15 if (not -e _) { }
15 0 elsif (-l _ or not -d _) { }
1199 9 15 if ($pathdb)
1220 0 1411 if ($self->verbose)
1221 0 0 -e $dst ? :
1236 0 1411 if ($self->verbose)
1241 11 1400 if (@$dlcollector >= $max_files_per_connection) { }
1244 11 0 unless defined $sleep
1246 6 5 if ($options->{'piecemeal'})
1253 0 5 if (not $success or $@)
1258 0 5 if ($self->verbose)
1267 18 10 if ($pathdb)
1290 26 0 if (rename $trecentfile, $rfile) { }
1297 10 16 if (my $ctfh = $self->_current_tempfile_fh)
1307 15 15 unless (unlink $dst)
1309 0 15 if $options->{'verbose'}
1311 0 30 if ($self->verbose)
1326 0 0 unless (rmdir $dst)
1328 0 0 if $options->{'verbose'}
1330 0 0 if ($self->verbose)
1365 28 0 if (ref $path and ref $path eq 'ARRAY') { }
1391 0 0 if ($self->_my_ignore_link_stat_errors and join($", @err) =~ /^ rsync: \s link_stat /x)
1392 0 0 if ($self->verbose)
1399 0 0 if (++$retried >= 3)
1407 28 0 unless ($gaveup)
1423 0 0 if ($self->_my_ignore_link_stat_errors and join($", @err) =~ /^ rsync: \s link_stat /x)
1424 0 0 if ($self->verbose)
1440 0 0 unless defined $x
1447 33 6586 if ($self->_use_tempfile)
1450 6586 33 unless ($rfile and -s $rfile)
1519 37 6560 if ($self->is_slave)
1523 0 6597 unless my $rfile_or_tempfile = $self->_my_current_rfile
1524 110 6487 unless -e $rfile_or_tempfile
1534 0 6487 if ($err or not $data)
1538 0 6487 if (&reftype($data) eq 'ARRAY') { }
1547 4482 2005 unless grep {defined $options{$_};} 'after', 'before', 'contains', 'max', 'skip-deletes'
1556 2000 5 if ($info)
1560 5 2000 if (defined $options->{'after'})
1561 5 0 if ($re->[0]{'epoch'} > $options->{'after'}) { }
1562 5 0 if (my $f = &first(sub { $re->[$_]{'epoch'} <= $options->{'after'}; } , 0 .. $#$re))
1574 2000 5 if (defined $options->{'before'})
1575 1850 150 if ($re->[0]{'epoch'} > $options->{'before'}) { }
1576 625 1225 if (my $f = &first(sub { $re->[$_]{'epoch'} < $options->{'before'}; } , 0 .. $last_item))
1587 2005 0 if (0 != $first_item or -1 != $last_item)
1590 0 2005 if ($options->{'skip-deletes'})
1593 0 2005 if (my $contopt = $options->{'contains'})
1596 0 0 if (exists $contopt->{$allow})
1602 0 0 if (keys %$contopt > $seen_allowed)
1608 0 2005 if ($options->{'max'} and @$re > $options->{'max'})
1622 6487 55481 if ($k ne lc $k)
1626 45021 10460 if defined $self->$k
1631 6487 0 if (my(@stat) = stat $rfile_or_tempfile) { }
1647 6487 0 if (@$re)
1660 6487 0 if ($suffix eq '.yaml') { }
0 0 elsif ($HAVE->{'Data::Serializer'}) { }
1668 0 0 unless open my $fh, $rfile_or_tempfile
1690 5 18 if ($old_dirtymark and $new_dirtymark and $new_dirtymark ne $old_dirtymark)
1723 5 10 if (defined $set)
1743 14 69 if (defined $set)
1747 5 78 unless (defined $remoteroot)
1748 0 5 defined $self->remote_host ? :
0 5 defined $self->remote_module ? :
5 0 defined $self->remote_dir ? :
1779 5 0 if (my($f, $i, $s) = $rfname =~ /$splitter/) { }
1798 11116 4980 if defined $rfile
1817 26 43 unless (defined $rsync)
1819 26 0 if ($HAVE->{'File::Rsync'}) { }
1849 0 0 unless defined $max_rsync_errors
1850 0 0 if ($max_rsync_errors >= 0 and $no_success_count >= $max_rsync_errors)
1863 0 0 if $sleep > 300
1914 3312 48304 if ref $o
1929 43 0 unless defined $ttl
1930 10 33 if ($now > $have_mirrored + $ttl)
1945 5198 3088 unless $self->_is_locked
1947 0 3088 unless unlink "$rfile.lock/process"
1948 0 3088 unless rmdir "$rfile.lock"
1999 35 1579 unless @$recent
2000 1414 165 if (&_bigfloatgt('' . $epoch, $recent->[0]{'epoch'})) { }
2008 0 354 if (defined $path or defined $type or defined $dirty_epoch)
2009 0 1292 unless defined $path
2010 0 1292 unless defined $type
2011 0 1292 unless $type =~ /(new|delete)/
2015 1334 312 if $ctx->{'something_done'}
2038 0 0 if $ctx->{'something_done'}
2046 35 1611 unless ($recent->[0])
2053 390 1256 unless ($canonmeth)
2059 0 1646 if ($self->verbose and @$batch > 1)
2061 0 0 if $@
2071 0 1646 if $console and not $i % 50
2079 0 1646 if $console
2080 32 1614 if ($setting_new_dirty_mark)
2084 1004 1646 if (&_bigfloatlt($recent->[-1]{'epoch'}, $oldest_allowed)) { }
2096 0 354 if (defined $path or defined $type or defined $dirty_epoch)
2103 32 1614 if (defined $dirty_epoch and &_bigfloatgt($now, $dirty_epoch)) { }
2110 877 769 if ($merged->{'epoch'} and not $setting_new_dirty_mark) { }
2119 1292 354 if (defined $path and $path =~ s/^\Q$lrd\E//)
2123 32 1260 if (defined $dirty_epoch) { }
2130 0 32 if (&_bigfloatgt($epoch, $now))
2135 32 0 if (not defined $merged->{'epoch'} or &_bigfloatlt($epoch, $merged->{'epoch'}))
2142 1292 0 if (defined $splicepos)
2162 0 32 if (exists $paths_in_recent->{$path})
2165 0 0 if ($recent->[$i]{'path'} eq $path) { }
2166 0 0 if ($recent->[$i]{'epoch'} eq $epoch)
2175 0 0 unless $cancel
2177 0 32 if (not exists $recent->[0] or &_bigfloatgt($epoch, $recent->[0]{'epoch'})) { }
32 0 elsif (&_bigfloatlt($epoch, $recent->[-1]{'epoch'})) { }
2183 0 0 if (&_bigfloatgt(scalar($memo_splicepos <= $#$recent && $epoch), $recent->[$memo_splicepos]{'epoch'})) { }
2190 0 0 if ($epoch eq $recent->[$i]{'epoch'})
2191 0 0 $i ? :
2193 0 0 if (&_bigfloatgt($epoch, $recent->[$i]{'epoch'}))
2224 95 39 if (defined $set)
2228 8 126 unless (defined $x)
2245 19 37 if ($self->_uptodateness_ever_reached and not $self->seeded)
2257 37 19 unless (defined $uptodate)
2260 21 16 if (exists $minmax->{'mtime'})
2263 21 0 if (@stat) { }
2265 0 21 if (defined $mtime and defined $minmax->{'mtime'} and $mtime > $minmax->{'mtime'}) { }
2270 21 0 defined $covered ? :
2281 16 40 unless (defined $uptodate)
2285 34 22 if ($uptodate)
2310 0 2707 unless defined $recent
2313 0 99709 if (defined $Last_epoch and &_bigfloatge($recent->[$i]{'epoch'}, $Last_epoch))
2324 1668 1039 if (not defined $minmax->{'max'} or &_bigfloatlt($minmax->{'max'}, $recent->[0]{'epoch'}))
2325 1668 0 @$recent && exists $recent->[0]{'epoch'} ? :
2327 583 2124 if (not defined $minmax->{'min'} or &_bigfloatlt($minmax->{'min'}, $recent->[-1]{'epoch'}))
2328 583 0 @$recent && exists $recent->[-1]{'epoch'} ? :
2345 0 0 unless rename "$rfile.new", $rfile
2363 2692 15 if ($suffix eq '.yaml') { }
15 0 elsif ($HAVE->{'Data::Serializer'}) { }
2372 0 2707 unless open my $fh, '>', "$rfile.new"
2374 0 2707 unless close $fh
2375 0 2707 unless rename "$rfile.new", $rfile