aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2014-11-10 18:08:58 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-11-12 10:48:37 +0100
commitd5946d420f14ade23362a67188d80a5c95f66c0a (patch)
treed777765a9d6ba4eb47966f8f504c24d564c409e7
parente8053418e43127327f6df892ae774a1707a9ae97 (diff)
teach init-repository about branches
specifically, add the --branch option and the necessary keys to .gitmodules. Change-Id: I09e2df6bd012629f76a35238d66697637bdffe44 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--.gitmodules36
-rwxr-xr-xinit-repository33
2 files changed, 65 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules
index 714bcc7c..958a63ce 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,139 +1,175 @@
[submodule "qtbase"]
path = qtbase
url = ../qtbase.git
+ branch = 5.4.0
initrepo = true
[submodule "qtsvg"]
path = qtsvg
url = ../qtsvg.git
+ branch = 5.4.0
initrepo = true
[submodule "qtdeclarative"]
path = qtdeclarative
url = ../qtdeclarative.git
+ branch = 5.4.0
initrepo = true
[submodule "qtactiveqt"]
path = qtactiveqt
url = ../qtactiveqt.git
+ branch = 5.4.0
initrepo = true
[submodule "qtscript"]
path = qtscript
url = ../qtscript.git
+ branch = 5.4.0
initrepo = true
[submodule "qtmultimedia"]
path = qtmultimedia
url = ../qtmultimedia.git
+ branch = 5.4.0
initrepo = true
[submodule "qttools"]
path = qttools
url = ../qttools.git
+ branch = 5.4.0
initrepo = true
[submodule "qtxmlpatterns"]
path = qtxmlpatterns
url = ../qtxmlpatterns.git
+ branch = 5.4.0
initrepo = true
[submodule "qttranslations"]
path = qttranslations
url = ../qttranslations.git
+ branch = 5.4.0
initrepo = true
[submodule "qtdoc"]
path = qtdoc
url = ../qtdoc.git
+ branch = 5.4.0
initrepo = true
[submodule "qtrepotools"]
path = qtrepotools
url = ../qtrepotools.git
+ branch = master
initrepo = true
[submodule "qtwebkit"]
path = qtwebkit
url = ../qtwebkit.git
+ branch = 5.4.0
initrepo = true
[submodule "qtwebkit-examples"]
path = qtwebkit-examples
url = ../qtwebkit-examples.git
+ branch = 5.4.0
initrepo = true
[submodule "qtqa"]
path = qtqa
url = ../qtqa.git
+ branch = master
initrepo = true
[submodule "qtlocation"]
path = qtlocation
url = ../qtlocation.git
+ branch = 5.4.0
initrepo = true
[submodule "qtsensors"]
path = qtsensors
url = ../qtsensors.git
+ branch = 5.4.0
initrepo = true
[submodule "qtsystems"]
path = qtsystems
url = ../qtsystems.git
+ branch = dev
[submodule "qtfeedback"]
path = qtfeedback
url = ../qtfeedback.git
+ branch = master
[submodule "qtdocgallery"]
path = qtdocgallery
url = ../qtdocgallery.git
+ branch = master
[submodule "qtpim"]
path = qtpim
url = ../qtpim.git
+ branch = dev
[submodule "qtconnectivity"]
path = qtconnectivity
url = ../qtconnectivity.git
+ branch = 5.4.0
initrepo = true
[submodule "qtwayland"]
path = qtwayland
url = ../qtwayland.git
+ branch = 5.4.0
initrepo = true
[submodule "qt3d"]
path = qt3d
url = ../qt3d.git
+ branch = dev
[submodule "qtimageformats"]
path = qtimageformats
url = ../qtimageformats.git
+ branch = 5.4.0
initrepo = true
[submodule "qtquick1"]
path = qtquick1
url = ../qtquick1.git
+ branch = 5.4.0
initrepo = true
[submodule "qtgraphicaleffects"]
path = qtgraphicaleffects
url = ../qtgraphicaleffects.git
+ branch = 5.4.0
initrepo = true
[submodule "qtquickcontrols"]
path = qtquickcontrols
url = ../qtquickcontrols.git
+ branch = 5.4.0
initrepo = true
[submodule "qtserialport"]
path = qtserialport
url = ../qtserialport.git
+ branch = 5.4.0
initrepo = true
[submodule "qtx11extras"]
path = qtx11extras
url = ../qtx11extras.git
+ branch = 5.4.0
initrepo = true
[submodule "qtmacextras"]
path = qtmacextras
url = ../qtmacextras.git
+ branch = 5.4.0
initrepo = true
[submodule "qtwinextras"]
path = qtwinextras
url = ../qtwinextras.git
+ branch = 5.4.0
initrepo = true
[submodule "qtandroidextras"]
path = qtandroidextras
url = ../qtandroidextras.git
+ branch = 5.4.0
initrepo = true
[submodule "qtenginio"]
path = qtenginio
url = ../qtenginio.git
+ branch = 1.1.0
initrepo = true
[submodule "qtwebsockets"]
path = qtwebsockets
url = ../qtwebsockets.git
+ branch = 5.4.0
initrepo = true
[submodule "qtwebchannel"]
path = qtwebchannel
url = ../qtwebchannel.git
+ branch = 5.4.0
initrepo = true
[submodule "qtwebengine"]
path = qtwebengine
url = ../qtwebengine.git
+ branch = 5.4.0
initrepo = true
diff --git a/init-repository b/init-repository
index 6a2d2f74..3fdfa83f 100755
--- a/init-repository
+++ b/init-repository
@@ -105,6 +105,12 @@ Module names may be prefixed with a dash to exclude them from a bigger set.
Skip the `git submodule update' command.
+=item --branch
+
+Instead of checking out specific SHA1s, check out the submodule branches that
+correspond with the current supermodule commit.
+By default, this option will cause local commits in the submodules to be rebased.
+With --no-update, the branches will be checked out, but their heads will not move.
=item --ignore-submodules
@@ -233,6 +239,7 @@ sub parse_arguments
%{$self} = (%{$self},
'alternates' => "",
+ 'branch' => 0,
'codereview-username' => "",
'detach-alternates' => 0 ,
'force' => 0 ,
@@ -246,6 +253,7 @@ sub parse_arguments
GetOptionsFromArray(\@args,
'alternates=s' => \$self->{qw{ alternates }},
+ 'branch' => \$self->{qw{ branch }},
'codereview-username=s' => \$self->{qw{ codereview-username }},
'copy-objects' => \$self->{qw{ detach-alternates }},
'force|f' => \$self->{qw{ force }},
@@ -313,9 +321,10 @@ sub git_submodule_init
sub git_clone_all_submodules
{
- my ($self, $my_repo_base, @subset) = @_;
+ my ($self, $my_repo_base, $co_branch, @subset) = @_;
my %subdirs = ();
+ my %subbranches = ();
my %subbases = ();
my %subinits = ();
my @submodconfig = qx(git config -l -f .gitmodules);
@@ -324,6 +333,8 @@ sub git_clone_all_submodules
next if ($line !~ /^submodule\.([^.=]+)\.([^.=]+)=(.*)$/);
if ($2 eq "path") {
$subdirs{$1} = $3;
+ } elsif ($2 eq "branch") {
+ $subbranches{$1} = $3;
} elsif ($2 eq "url") {
my ($mod, $base) = ($1, $3);
next if ($base !~ /^\.\.\//);
@@ -376,16 +387,30 @@ sub git_clone_all_submodules
}
if ($self->{update}) {
- $self->exe('git', 'submodule', 'update');
+ $self->exe('git', 'submodule', 'update', ($co_branch ? ('--remote', '--rebase') : ()));
foreach my $module (@modules) {
if (-f $module.'/.gitmodules') {
my $orig_cwd = getcwd();
chdir($module) or confess "chdir $module: $OS_ERROR";
- $self->git_clone_all_submodules($subbases{$module}, "all");
+ $self->git_clone_all_submodules($subbases{$module}, 0, "all");
chdir("$orig_cwd") or confess "chdir $orig_cwd: $OS_ERROR";
}
}
+ } elsif ($co_branch) {
+ foreach my $module (@modules) {
+ my $branch = $subbranches{$module};
+ die("No branch defined for submodule $module.\n") if (!defined($branch));
+ my $orig_cwd = getcwd();
+ chdir($module) or confess "chdir $module: $OS_ERROR";
+ my $br = qx(git rev-parse -q --verify $branch);
+ if (!$br) {
+ $self->exe('git', 'checkout', '-b', $branch, "origin/$branch");
+ } else {
+ $self->exe('git', 'checkout', $branch);
+ }
+ chdir("$orig_cwd") or confess "chdir $orig_cwd: $OS_ERROR";
+ }
}
return;
@@ -532,7 +557,7 @@ sub run
$url =~ s,qt/qt5$,,;
$self->{'base-url'} = $url;
- $self->git_clone_all_submodules('qt/qt5', @{$self->{'module-subset'}});
+ $self->git_clone_all_submodules('qt/qt5', $self->{branch}, @{$self->{'module-subset'}});
$self->git_add_remotes('qt/qt5');