summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFabien Tassin <fta@ubuntu.com>2009-01-19 23:24:19 +0100
committerFabien Tassin <fta@ubuntu.com>2009-01-19 23:24:19 +0100
commitfe1c29ce77a9cd7a404d3da0b9ef45e0648b7fc3 (patch)
tree984faef706a8c589ddda2d8dbb6999509091b7d9 /src
parent728f0d60d6d5452d178f6a5ad06aa2d4a869f05a (diff)
* [mozclient] add support for local branches instead of the configured remote ones.
It is faster if you have to publish tarballs quite often from a branch, such as when doing daily snapshots. - update src/mozclient.mk.in - update src/mozclient/lib/MozClient/{CVS,Git,Mercurial,Subversion,VCS}.pm - update src/mozclient/mozclient.pl - update README
Diffstat (limited to 'src')
-rw-r--r--src/mozclient.mk.in4
-rw-r--r--src/mozclient/lib/MozClient/CVS.pm6
-rw-r--r--src/mozclient/lib/MozClient/Git.pm6
-rw-r--r--src/mozclient/lib/MozClient/Mercurial.pm7
-rw-r--r--src/mozclient/lib/MozClient/Subversion.pm6
-rw-r--r--src/mozclient/lib/MozClient/VCS.pm8
-rwxr-xr-xsrc/mozclient/mozclient.pl2
7 files changed, 39 insertions, 0 deletions
diff --git a/src/mozclient.mk.in b/src/mozclient.mk.in
index a8b0c43..3d2955e 100644
--- a/src/mozclient.mk.in
+++ b/src/mozclient.mk.in
@@ -57,6 +57,10 @@ ifdef MOZCLIENT_PROJECTDIR
ARGS += -c $(MOZCLIENT_PROJECTDIR)
endif
+ifdef LOCAL_BRANCH
+ ARGS += -L $(LOCAL_BRANCH)
+endif
+
ifeq (,$(MOZCLIENT_PROJECTNAME))
$(error You must specify MOZCLIENT_PROJECTNAME)
endif
diff --git a/src/mozclient/lib/MozClient/CVS.pm b/src/mozclient/lib/MozClient/CVS.pm
index a7bd1b6..81cbb7c 100644
--- a/src/mozclient/lib/MozClient/CVS.pm
+++ b/src/mozclient/lib/MozClient/CVS.pm
@@ -129,6 +129,12 @@ sub checkout {
my $self = shift;
$self->LOG("MozClient:CVS::checkout:()");
+
+ if (defined $self->{'local-branch'}) {
+ confess "Can't MozClient::checkout() a local branch for " . $self->vcs;
+ # TODO: fix it if needed
+ }
+
$self->chdir($self->work_dir);
if (defined $self->{'MOZCLIENT_PROJECT'}) {
my $cmd = sprintf "make -f %s checkout MOZ_CO_PROJECT=%s %s %s",
diff --git a/src/mozclient/lib/MozClient/Git.pm b/src/mozclient/lib/MozClient/Git.pm
index 393032b..e160af3 100644
--- a/src/mozclient/lib/MozClient/Git.pm
+++ b/src/mozclient/lib/MozClient/Git.pm
@@ -23,6 +23,7 @@ package MozClient::Git;
use vars qw(@ISA);
use strict;
+use Carp;
use MozClient::VCS;
@ISA = ("MozClient::VCS");
@@ -66,6 +67,11 @@ sub checkout {
my $self = shift;
$self->LOG("MozClient:Git::checkout:()");
+
+ if (defined $self->{'local-branch'}) {
+ confess "Can't MozClient::checkout() a local branch for " . $self->vcs;
+ # TODO: fix it if needed
+ }
$self->chdir($self->work_dir);
my $modules = [];
if (defined $self->{'MOZCLIENT_PROJECT'}) {
diff --git a/src/mozclient/lib/MozClient/Mercurial.pm b/src/mozclient/lib/MozClient/Mercurial.pm
index 40f2879..f3c4527 100644
--- a/src/mozclient/lib/MozClient/Mercurial.pm
+++ b/src/mozclient/lib/MozClient/Mercurial.pm
@@ -66,6 +66,13 @@ sub checkout {
my $self = shift;
$self->LOG("MozClient:Mercurial::checkout:()");
+ if (defined $self->{'local-branch'}) {
+ chomp(my $cwd = `pwd`);
+ $self->chdir($self->{'local-branch'});
+ $self->run_system("hg pull");
+ $self->run_system("hg update");
+ $self->chdir($cwd);
+ }
$self->chdir($self->work_dir);
my $modules = [];
if (defined $self->{'MOZCLIENT_PROJECT'}) {
diff --git a/src/mozclient/lib/MozClient/Subversion.pm b/src/mozclient/lib/MozClient/Subversion.pm
index dc35564..0437a50 100644
--- a/src/mozclient/lib/MozClient/Subversion.pm
+++ b/src/mozclient/lib/MozClient/Subversion.pm
@@ -23,6 +23,7 @@ package MozClient::Subversion;
use vars qw(@ISA);
use strict;
+use Carp;
use MozClient::VCS;
@ISA = ("MozClient::VCS");
@@ -69,6 +70,11 @@ sub checkout {
$self->LOG("MozClient::Subversion::checkout:()");
+ if (defined $self->{'local-branch'}) {
+ confess "Can't MozClient::checkout() a local branch for " . $self->vcs;
+ # TODO: fix it if needed
+ }
+
$self->chdir($self->work_dir);
my $modules = [];
$self->{'MOZCLIENT_VCS_LOC'} .= "/" unless $self->{'MOZCLIENT_VCS_LOC'} =~ m,/$,;
diff --git a/src/mozclient/lib/MozClient/VCS.pm b/src/mozclient/lib/MozClient/VCS.pm
index 29963ec..4999cdc 100644
--- a/src/mozclient/lib/MozClient/VCS.pm
+++ b/src/mozclient/lib/MozClient/VCS.pm
@@ -63,6 +63,14 @@ sub new {
# The following options overwrite the conf files
$self->{'MOZCLIENT_EMBEDDED'} = 1 if $$opt{'embedded'};
$self->{'MOZ_CO_MODULE'} = $$opt{'modules'} if defined $$opt{'modules'};
+ if (defined $$opt{'local-branch'}) {
+ my $branch = $$opt{'local-branch'};
+ $self->{'local-branch'} = $branch;
+ $branch =~ s,/+$,,;
+ my ($repo, $dir) = $branch =~ m,(.*/)([^/]+)$,;
+ $self->{'MOZCLIENT_VCS_LOC'} = $repo;
+ $self->{'MOZCLIENT_PROJECT'} = $dir;
+ }
bless($self, $class);
$self;
diff --git a/src/mozclient/mozclient.pl b/src/mozclient/mozclient.pl
index d106231..746062e 100755
--- a/src/mozclient/mozclient.pl
+++ b/src/mozclient/mozclient.pl
@@ -79,6 +79,7 @@ mozclient [-l] project-name
--preserve-vcs|-p preserve VCS files
--embedded|-e create an embedded tarball
--modules|-m mods list of modules to fetch
+ --local-branch|-L branch use a local branch instead of the configured one
--debug|-D increase debug level
Examples:
@@ -188,6 +189,7 @@ GetOptions($opt,
'tag|t=s',
'embedded|e',
'modules|m=s',
+ 'local-branch|L=s',
'preserve-vcs|p') || &help();
&help() unless $#ARGV >= 0;