summaryrefslogtreecommitdiffstats
path: root/Bugzilla/PatchReader/CVSClient.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-08-16 16:10:14 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-08-16 16:10:14 +0200
commit04669c69cd4d6e1f2e279f04c4595ed55ec490e1 (patch)
tree4d8b0c868d90d8e91d3cc70e74dd14202e08ded5 /Bugzilla/PatchReader/CVSClient.pm
parentba0b995c4453d3642e19343fa98f1b4034114f39 (diff)
downloadbugzilla-04669c69cd4d6e1f2e279f04c4595ed55ec490e1.tar.gz
bugzilla-04669c69cd4d6e1f2e279f04c4595ed55ec490e1.tar.xz
Bug 779862: shift PatchReader into bugzilla namespace and fix long standing issues
Diffstat (limited to 'Bugzilla/PatchReader/CVSClient.pm')
-rw-r--r--Bugzilla/PatchReader/CVSClient.pm48
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