Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion vcstool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .clients import vcstool_clients # noqa

__version__ = '0.3.0'
__version__ = '0.3.1'
7 changes: 6 additions & 1 deletion vcstool/clients/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ def import_(self, command):

# fetch updates for existing repo
cmd_fetch = [GitClient._executable, 'fetch', remote]
if command.partial_clone:
cmd_fetch.append("--filter=blob:none")
if command.shallow:
result_version_type, version_name = self._check_version_type(
command.url, checkout_version)
Expand Down Expand Up @@ -386,7 +388,10 @@ def import_(self, command):

if not command.shallow or version_type in (None, 'branch'):
cmd_clone = [GitClient._executable, 'clone', command.url, '.']
if version_type == 'branch':
if command.partial_clone:
cmd_clone += ["--filter=blob:none", "--no-checkout"]
checkout_version = command.version
elif version_type == 'branch':
cmd_clone += ['-b', version_name]
checkout_version = None
else:
Expand Down
5 changes: 5 additions & 0 deletions vcstool/commands/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(
self.skip_existing = args.skip_existing
self.recursive = recursive
self.shallow = shallow
self.partial_clone = args.partial_clone


def get_parser():
Expand All @@ -60,6 +61,10 @@ def get_parser():
'--skip-existing', action='store_true', default=False,
help="Don't overwrite existing directories or change custom checkouts "
'in repos using the same URL (but fetch repos with same URL)')
group.add_argument(
'--partial-clone', action='store_true', default=False,
help="Only clone the partial git first, then checkout to the target version"
)

return parser

Expand Down