summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFabien Tassin <fta@sofaraway.org>2008-06-06 15:53:39 +0200
committerFabien Tassin <fta@sofaraway.org>2008-06-06 15:53:39 +0200
commited677e453e93d607a31366eb12816cf8e55daaf5 (patch)
treef9afb32a567f4794b8d8e37c5a83bdafcdae9ec8 /src
parent705330e592cd154dddf882c8ab6699f2be8aa087 (diff)
* [mozclient] add support for svn
- add src/mozclient/lib/MozClient/Subversion.pm - update src/mozclient.pl
Diffstat (limited to 'src')
-rwxr-xr-xsrc/mozclient.pl6
-rw-r--r--src/mozclient/lib/MozClient/Subversion.pm86
2 files changed, 90 insertions, 2 deletions
diff --git a/src/mozclient.pl b/src/mozclient.pl
index d4050a3..160ece7 100755
--- a/src/mozclient.pl
+++ b/src/mozclient.pl
@@ -167,6 +167,7 @@ sub read_project_file {
use MozClient::CVS;
use MozClient::Mercurial;
+use MozClient::Subversion;
# Main
my $opt = {};
@@ -185,8 +186,9 @@ my $conf = &read_project_file(shift @ARGV);
my $client;
my $vcs = $$conf{'MOZCLIENT_VCS'};
-$vcs eq 'cvs' && do { $client = MozClient::CVS->new($conf, $opt); 1; } ||
-$vcs eq 'hg' && do { $client = MozClient::Mercurial->new($conf, $opt); 1; } ||
+$vcs eq 'cvs' && do { $client = MozClient::CVS->new($conf, $opt); 1; } ||
+$vcs eq 'svn' && do { $client = MozClient::Subversion->new($conf, $opt); 1; } ||
+$vcs eq 'hg' && do { $client = MozClient::Mercurial->new($conf, $opt); 1; } ||
do {
die "VCS '$$conf{'MOZCLIENT_VCS'}' not supported yet";
};
diff --git a/src/mozclient/lib/MozClient/Subversion.pm b/src/mozclient/lib/MozClient/Subversion.pm
new file mode 100644
index 0000000..96ea1f9
--- /dev/null
+++ b/src/mozclient/lib/MozClient/Subversion.pm
@@ -0,0 +1,86 @@
+# -*- mode: Perl -*-
+
+# Copyright (c) 2007-2008 Fabien Tassin <fta@sofaraway.org>
+# Description: MozClient::Subversion
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+############################################################################
+
+package MozClient::Subversion;
+
+use vars qw(@ISA);
+use strict;
+use MozClient::VCS;
+
+@ISA = ("MozClient::VCS");
+
+sub get_client {
+ my $self = shift;
+
+ $self->LOG("MozClient::Subversion::get_client()");
+ # nothing to do
+}
+
+sub convert_revdate {
+ my $self = shift;
+ my $arg = shift;
+
+ $self->LOG("MozClient::Subversion::convert_revdate($arg)");
+ $arg =~ s,.*r(\d+),$1,;
+ $arg;
+}
+
+sub set_revdate {
+ my $self = shift;
+
+ $self->LOG("MozClient::Subversion::set_revdate()");
+
+ # We can set a revision for svn
+ $self->{'mozclient_date'} =
+ '-r ' . $self->convert_revdate($self->{'have_date'});
+}
+
+sub checkout {
+ my $self = shift;
+
+ $self->LOG("MozClient:Subversion::checkout:()");
+ $self->chdir($self->work_dir);
+ my $modules = [];
+ $self->{'MOZCLIENT_VCS_LOC'} .= "/" unless $self->{'MOZCLIENT_VCS_LOC'} =~ m,/$,;
+ if (defined $self->{'MOZCLIENT_PROJECT'}) {
+ push @$modules,
+ $self->{'MOZCLIENT_VCS_LOC'} . $self->{'MOZCLIENT_PROJECT'} . "/";
+ }
+ else {
+ for my $module (@{$self->{'MOZCLIENT_MODULES'}}) {
+ push @$modules, (sprintf " %s%s/%s", $self->{'MOZCLIENT_VCS_LOC'},
+ $self->{'MOZCLIENT_PROJECT'}, $module);
+ }
+ }
+ my $cmd = sprintf "svn checkout %s %s mozilla", $self->{'mozclient_date'},
+ join " ", @$modules;
+ $self->run_system($cmd);
+ $self->chdir("..");
+}
+
+sub tar_exclude {
+ my $self = shift;
+
+ $self->LOG("MozClient::Subversion::tar_exclude()");
+ [ '--exclude .svn' ];
+}
+
+1;