File Coverage

lib/PatchReader/CVSClient.pm
Criterion Covered Total %
statement 15 22 68.1
branch 2 4 50.0
condition 0 4 0.0
subroutine 2 4 50.0
pod 0 3 0.0
total 19 37 51.3


line stmt bran cond sub pod time code
1             # -*- Mode: perl; indent-tabs-mode: nil -*-
2             #
3             # The contents of this file are subject to the Mozilla Public
4             # License Version 1.1 (the "License"); you may not use this file
5             # except in compliance with the License. You may obtain a copy of
6             # the License at http://www.mozilla.org/MPL/
7             #
8             # Software distributed under the License is distributed on an "AS
9             # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10             # implied. See the License for the specific language governing
11             # rights and limitations under the License.
12             #
13             # The Original Code is the Bugzilla Bug Tracking System.
14             #
15             # The Initial Developer of the Original Code is Netscape Communications
16             # Corporation. Portions created by Netscape are
17             # Copyright (C) 2003 Netscape Communications Corporation. All
18             # Rights Reserved.
19             #
20             # Contributor(s): John Keiser
21              
22             package PatchReader::CVSClient;
23              
24 4     4   18 use strict;
  4         8  
  4         1543  
25              
26             sub parse_cvsroot {
27 4     4 0 11 my $cvsroot = $_[0];
28             # Format: :method:[user[:password]@]server[:[port]]/path
29 4 50       46 if ($cvsroot =~ /^:([^:]*):(.*?)(\/.*)$/) {
30 4         7 my %retval;
31 4         20 $retval{protocol} = $1;
32 4         15 $retval{rootdir} = $3;
33 4         10 my $remote = $2;
34 4 50       39 if ($remote =~ /^(([^\@:]*)(:([^\@]*))?\@)?([^:]*)(:(.*))?$/) {
35 4         12 $retval{user} = $2;
36 4         11 $retval{password} = $4;
37 4         12 $retval{server} = $5;
38 4         10 $retval{port} = $7;
39 4         45 return %retval;
40             }
41             }
42              
43             return (
44 0           rootdir => $cvsroot
45             );
46             }
47              
48             sub cvs_co {
49 0     0 0   my ($cvsroot, @files) = @_;
50 0   0       my $cvs = $::cvsbin || "cvs";
51 0           return system($cvs, "-Q", "-d$cvsroot", "co", @files);
52             }
53              
54             sub cvs_co_rev {
55 0     0 0   my ($cvsroot, $rev, @files) = @_;
56 0   0       my $cvs = $::cvsbin || "cvs";
57 0           return system($cvs, "-Q", "-d$cvsroot", "co", "-r$rev", @files);
58             }
59              
60             1