Commit 357d29a0 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

add --no-fetch option


there is no point in re-fetching all repositories just because an update
failed due to local modifications.

Change-Id: Ie9883586d77f3310058353844f0bbcfb0b775ebb
Reviewed-by: default avatarEdward Welbourne <edward.welbourne@qt.io>
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@qt.io>
parent d9141a32
dev 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.6 5.7 5.8 5.9 5.9.8 6.0 6.0.0 6.1 6.1.0 6.1.1 6.1.2 6.1.3 6.2 6.2.0 6.2.1 6.2.2 ifw-5.12.10 ifw-5.12.11 pyside6.0 pyside6.1 wip/cmake wip/emulator/master wip/flashing-wizard/master wip/installer-framework/3.0 wip/installer-framework/3.1 wip/installer-framework/master wip/navigation wip/ogl-runtime/2.4 wip/ogl-runtime/2.5 wip/ogl-runtime/2.6 wip/ogl-runtime/2.7 wip/ogl-runtime/master wip/pyside-setup/5.11.0 wip/pyside-setup/5.14 wip/qbs/1.10 wip/qbs/master wip/qdb/master wip/qt3d-runtime/2.0 wip/qt3d-runtime/2.0.1 wip/qt3d-runtime/2.1 wip/qt3d-runtime/2.2 wip/qt3d-runtime/2.3 wip/qt3d-runtime/2.4 wip/qt3d-runtime/master wip/qt3dstudio/2.0 wip/qt3dstudio/2.0.1 wip/qt3dstudio/2.1 wip/qt3dstudio/2.2 wip/qt3dstudio/2.3 wip/qt3dstudio/2.4 wip/qt3dstudio/2.5 wip/qt3dstudio/2.6 wip/qt3dstudio/2.7 wip/qt3dstudio/master wip/qt3dstudio/runtime2 wip/qt6 wip/qtsaferenderer/1.0 wip/qtsaferenderer/1.1 wip/qtsaferenderer/1.2 wip/qtsaferenderer/master wip/qtwebkit/5.212 wip/tqtc-qt-config-gui/master wip/vxworks/5.9.5 wip/webassembly v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.6.3
No related merge requests found
Showing with 12 additions and 4 deletions
......@@ -82,6 +82,9 @@ Options:
--no-update
Skip the `git submodule update' command.
--no-fetch
Skip the `git fetch' commands. Implied by --no-update.
--branch
Instead of checking out specific SHA1s, check out the submodule
branches that correspond with the current supermodule commit. By
......@@ -213,6 +216,7 @@ sub parse_arguments
'ignore-submodules' => 0 ,
'mirror-url' => "",
'update' => 1 ,
'fetch' => 1 ,
'module-subset' => "default",
);
......@@ -227,6 +231,7 @@ sub parse_arguments
'mirror=s' => \$self->{qw{ mirror-url }},
'quiet' => \$self->{qw{ quiet }},
'update!' => \$self->{qw{ update }},
'fetch!' => \$self->{qw{ fetch }},
'module-subset=s' => \$self->{qw{ module-subset }},
'help|?' => sub { printUsage(1); },
......@@ -245,6 +250,8 @@ sub parse_arguments
$self->{'module-subset'} =~ s/\bdefault\b/preview,essential,addon,deprecated/;
$self->{'module-subset'} = [ split(/,/, $self->{'module-subset'}) ];
$self->{'fetch'} = 0 if (!$self->{'update'});
return;
}
......@@ -466,9 +473,11 @@ sub git_clone_one_submodule
}
}
my $do_clone = (! -e "$submodule/.git");
my $url = $self->{'base-url'}.$repo_basename;
my $mirror;
if ($mirror_url) {
if ($mirror_url && ($do_clone || $self->{fetch})) {
$mirror = $mirror_url.$repo_basename;
}
......@@ -481,7 +490,6 @@ sub git_clone_one_submodule
}
}
my $do_clone = (! -e "$submodule/.git");
if ($do_clone) {
if ($branch) {
push @reference_args, '--branch', $branch;
......@@ -501,14 +509,14 @@ sub git_clone_one_submodule
$self->exe('git', 'config', 'remote.mirror.fetch', '+refs/heads/*:refs/remotes/mirror/*');
}
if (!$do_clone && $self->{update}) {
if (!$do_clone && $self->{fetch}) {
# If we didn't clone, fetch from the right location. We always update
# the origin remote, so that submodule update --remote works.
$self->exe('git', 'config', 'remote.origin.url', ($mirror ? $mirror : $url));
$self->exe('git', 'fetch', 'origin');
}
if (!($do_clone || $self->{update}) || $mirror) {
if (!($do_clone || $self->{fetch}) || $mirror) {
# Leave the origin configured to the canonical URL. It's already correct
# if we cloned/fetched without a mirror; otherwise it may be anything.
$self->exe('git', 'config', 'remote.origin.url', $url);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment