Pass shallow flag through gclient to git_cache.py

BUG=261741

Review URL: https://codereview.chromium.org/278043005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@270542 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
hinoka@chromium.org 12 years ago
parent 73c31cd9d0
commit 46b874144e

@ -1738,6 +1738,9 @@ def CMDsync(parser, args):
parser.add_option('--output-json',
help='Output a json document to this path containing '
'summary information about the sync.')
parser.add_option('--shallow', action='store_true',
help='GIT ONLY - Do a shallow clone into the cache dir. '
'Requires Git 1.9+')
(options, args) = parser.parse_args(args)
client = GClient.LoadCurrentConfig(options)

@ -765,7 +765,15 @@ class GitWrapper(SCMWrapper):
if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
mirror_kwargs['refs'].append('refs/branch-heads/*')
mirror = git_cache.Mirror(url, **mirror_kwargs)
mirror.populate(verbose=options.verbose, bootstrap=True)
if options.shallow:
# HACK(hinoka): These repositories should be super shallow.
if 'flash' in url:
depth = 10
else:
depth = 10000
else:
depth = None
mirror.populate(verbose=options.verbose, bootstrap=True, depth=depth)
mirror.unlock()
return mirror.mirror_path if mirror.exists() else None

Loading…
Cancel
Save