File Coverage

blib/lib/Cvs/Command/Export.pm
Criterion Covered Total %
statement 30 30 100.0
branch 6 14 42.8
condition 1 3 33.3
subroutine 5 5 100.0
pod 0 1 0.0
total 42 53 79.2


line stmt bran cond sub pod time code
1             package Cvs::Command::Export;
2              
3 1     1   9 use strict;
  1         1  
  1         376  
4 1     1   3885 use Cvs::Result::Export;
  1         3  
  1         14  
5 1     1   37 use Cvs::Cvsroot;
  1         2  
  1         13  
6 1     1   34 use base qw(Cvs::Command::Base);
  1         7  
  1         632  
7              
8             sub init
9             {
10 1     1 0 2 my($self, $module, $param) = @_;
11 1 50       12 $self->SUPER::init(@_) or return;
12 1         8 $self->default_params
13             (
14             cvsroot => undef,
15             revision => undef,
16             date => undef,
17             reset => 0
18             );
19 1         7 $self->param($param);
20              
21             return
22 1 0 33     4 $self->error('Must define a date or a revision')
23             if(! defined $param->{date}
24             and ! defined $param->{revision});
25              
26 1 50       4 return $self->error('Mandatory option: module')
27             unless(defined $module);
28              
29 1         7 $self->command('export');
30 1 50       21 $self->push_arg('-d', $self->workdir())
31             if defined $self->workdir();
32 1 50       4 $self->push_arg('-A')
33             if $self->param->{reset};
34 1 50       4 $self->push_arg('-r', $self->param->{revision})
35             if defined $self->param->{revision};
36 1 50       3 $self->push_arg('-D', $self->param->{date})
37             if defined $self->param->{date};
38 1         4 $self->push_arg($module);
39 1         4 $self->go_into_workdir(0);
40              
41 1         25 my $result = new Cvs::Result::Export;
42 1         16 $self->result($result);
43              
44 1         17 my $main = $self->new_context();
45 1         7 $self->initial_context($main);
46              
47 1         17 return $self;
48             }
49              
50             1;
51             =pod
52              
53             =head1 LICENCE
54              
55             This library is free software; you can redistribute it and/or modify
56             it under the terms of the GNU Lesser General Public License as
57             published by the Free Software Foundation; either version 2.1 of the
58             License, or (at your option) any later version.
59              
60             This library is distributed in the hope that it will be useful, but
61             WITHOUT ANY WARRANTY; without even the implied warranty of
62             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
63             Lesser General Public License for more details.
64              
65             You should have received a copy of the GNU Lesser General Public
66             License along with this library; if not, write to the Free Software
67             Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
68             USA
69              
70             =head1 COPYRIGHT
71              
72             Copyright (C) 2003 - Olivier Poitrey
73