Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve import failure on very slow/unstable networks #265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions vcstool/clients/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def import_(self, command):
cmd_fetch = [GitClient._executable, 'fetch', remote]
if command.shallow:
result_version_type, version_name = self._check_version_type(
command.url, checkout_version)
command.url, checkout_version, command.retry)
if result_version_type['returncode']:
return result_version_type
version_type = result_version_type['version_type']
Expand Down Expand Up @@ -379,7 +379,7 @@ def import_(self, command):
version_type = None
if command.version:
result_version_type, version_name = self._check_version_type(
command.url, command.version)
command.url, command.version, command.retry)
if result_version_type['returncode']:
return result_version_type
version_type = result_version_type['version_type']
Expand Down Expand Up @@ -497,7 +497,7 @@ def _get_remote_urls(self):
'returncode': 0 if remote_urls else 1
}

def _check_version_type(self, url, version):
def _check_version_type(self, url, version, retry=0):
# check if version starts with heads/ or tags/
prefixes = {
'heads/': 'branch',
Expand All @@ -514,7 +514,7 @@ def _check_version_type(self, url, version):
}, version[len(prefix):]

cmd = [GitClient._executable, 'ls-remote', url, version]
result = self._run_command(cmd)
result = self._run_command(cmd, retry=retry)
if result['returncode']:
result['output'] = 'Could not determine ref type of version: ' + \
result['output']
Expand Down