diff options
author | Fabien Tassin <fta@ubuntu.com> | 2009-01-19 23:24:19 +0100 |
---|---|---|
committer | Fabien Tassin <fta@ubuntu.com> | 2009-01-19 23:24:19 +0100 |
commit | fe1c29ce77a9cd7a404d3da0b9ef45e0648b7fc3 (patch) | |
tree | 984faef706a8c589ddda2d8dbb6999509091b7d9 /src/mozclient | |
parent | 728f0d60d6d5452d178f6a5ad06aa2d4a869f05a (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/mozclient')
-rw-r--r-- | src/mozclient/lib/MozClient/CVS.pm | 6 | ||||
-rw-r--r-- | src/mozclient/lib/MozClient/Git.pm | 6 | ||||
-rw-r--r-- | src/mozclient/lib/MozClient/Mercurial.pm | 7 | ||||
-rw-r--r-- | src/mozclient/lib/MozClient/Subversion.pm | 6 | ||||
-rw-r--r-- | src/mozclient/lib/MozClient/VCS.pm | 8 | ||||
-rwxr-xr-x | src/mozclient/mozclient.pl | 2 |
6 files changed, 35 insertions, 0 deletions
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; |