From ed677e453e93d607a31366eb12816cf8e55daaf5 Mon Sep 17 00:00:00 2001 From: Fabien Tassin Date: Fri, 6 Jun 2008 15:53:39 +0200 Subject: * [mozclient] add support for svn - add src/mozclient/lib/MozClient/Subversion.pm - update src/mozclient.pl --- debian/changelog | 3 ++ src/mozclient.pl | 6 ++- src/mozclient/lib/MozClient/Subversion.pm | 86 +++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 src/mozclient/lib/MozClient/Subversion.pm diff --git a/debian/changelog b/debian/changelog index 1b5675b..4cfbe81 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,9 @@ mozilla-devscripts (0.09) UNRELEASED; urgency=low - update src/mozclient.pl - update src/src/mozclient/*.conf - update README + + add support for svn + - add src/mozclient/lib/MozClient/Subversion.pm + - update src/mozclient.pl * [ compare ] + Add build-tree/dist to the list of directories for compare1 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 +# 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; -- cgit v1.2.3