bin/rrr-aggregate

filter: Statementstmt 71.4% 20 / 28 Branchbran 20.0% 2 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 62.7% 27 / 43 CC 1 SCAR 0.0
CC
1
Cov
58%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« bin/rrr-overview ↑ Summary bin/rrr-init »
1 #!/usr/bin/perl
2  
3 =head1 NAME
4  
5 rrr-aggregate - merge a set of recentfiles
6  
7 =head1 SYNOPSIS
8  
9 rrr-aggregate [options] file
10  
11 =head1 OPTIONS
12  
13 =over 8
14  
15 =cut
16  
17 1 my @opt = <<'=back' =~ /B<--(\S+)>/g;
18  
19 =item B<--dry-run!>
20  
21 (TBD) Do not really run the command, ...
22  
23 =item B<--help|h>
24  
25 Prints a brief message and exits.
26  
27 =item B<--locktimeout=s>
28  
29 Sets the locktimeout. See L<File::Rsync::Mirror::Recentfile>.
30  
31 =item B<--verbose|v+>
32  
33 More feedback.
34  
35 =back
36  
37 =head1 DESCRIPTION
38  
39 rersyncrecent is a project to get speedy rsync operation on large
40 trees over multiple hosts. It maintains a collection of files with
41 metadata (so called recentfiles) that represent adjacent or
42 overlapping timespans of file change events.
43  
44 rrr-aggregate merges the recentfiles that describe a tree. The file
45 argument is the path to the principal (the shortest) in a collection
46 of recentfiles.
47  
48 =cut
49  
50  
51 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 1 ▶use File::Rsync::Mirror::Recentfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
55 1 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 1 ▶use Pod::Usage qw(pod2usage);
Subroutine BEGIN: called CC=1 SCAR=0.0
57  
58 1 our %Opt;
59 1 ▶GetOptions(\%Opt,
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions(\%main::Opt, @opt) or pod2usage(2) 1 0 1
60 @opt,
61 ) or pod2usage(2);
62  
63 1 ▶if ($Opt{help}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::Opt{"help"}) 1 0 1
64 1 pod2usage(0);
65 }
66  
67 0 ▶if (! @ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ARGV) 0 0 0
68 0 pod2usage(2);
69 }
70  
71 0 ▶if ($Opt{'dry-run'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::Opt{"dry-run"}) 0 0 0
72 0 die "FIXME: not yet implemented";
73 }
74  
75 0 my $rf = File::Rsync::Mirror::Recentfile->new_from_file($ARGV[0]);
76 0 ▶if (my $tout = $Opt{locktimeout}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $tout = $main::Opt{"locktimeout"}) 0 0 0
77 0 $rf->locktimeout($tout);
78 }
79 0 $rf->aggregate();
80  
81 __END__
« bin/rrr-overview ↑ Summary bin/rrr-init »