diff options
Diffstat (limited to 'Bugzilla/PatchReader/CVSClient.pm')
-rw-r--r-- | Bugzilla/PatchReader/CVSClient.pm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Bugzilla/PatchReader/CVSClient.pm b/Bugzilla/PatchReader/CVSClient.pm new file mode 100644 index 000000000..2f76fc18d --- /dev/null +++ b/Bugzilla/PatchReader/CVSClient.pm @@ -0,0 +1,48 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::PatchReader::CVSClient; + +use strict; + +sub parse_cvsroot { + my $cvsroot = $_[0]; + # Format: :method:[user[:password]@]server[:[port]]/path + if ($cvsroot =~ /^:([^:]*):(.*?)(\/.*)$/) { + my %retval; + $retval{protocol} = $1; + $retval{rootdir} = $3; + my $remote = $2; + if ($remote =~ /^(([^\@:]*)(:([^\@]*))?\@)?([^:]*)(:(.*))?$/) { + $retval{user} = $2; + $retval{password} = $4; + $retval{server} = $5; + $retval{port} = $7; + return %retval; + } + } + + return ( + rootdir => $cvsroot + ); +} + +sub cvs_co { + my ($cvsroot, @files) = @_; + my $cvs = $::cvsbin || "cvs"; + return system($cvs, "-Q", "-d$cvsroot", "co", @files); +} + +sub cvs_co_rev { + my ($cvsroot, $rev, @files) = @_; + my $cvs = $::cvsbin || "cvs"; + return system($cvs, "-Q", "-d$cvsroot", "co", "-r$rev", @files); +} + +1 |