Merge "init: add --submodules to sync manifest submodules"

This commit is contained in:
David Pursehouse
2017-05-27 04:24:58 +00:00
committed by Gerrit Code Review
5 changed files with 59 additions and 12 deletions

View File

@ -111,6 +111,9 @@ to update the working directory files.
dest='archive', action='store_true',
help='checkout an archive instead of a git repository for '
'each project. See git archive.')
g.add_option('--submodules',
dest='submodules', action='store_true',
help='sync any submodules associated with the manifest repo')
g.add_option('-g', '--groups',
dest='groups', default='default',
help='restrict manifest projects to ones with specified '
@ -236,10 +239,13 @@ to update the working directory files.
'in another location.', file=sys.stderr)
sys.exit(1)
if opt.submodules:
m.config.SetString('repo.submodules', 'true')
if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet,
clone_bundle=not opt.no_clone_bundle,
current_branch_only=opt.current_branch_only,
no_tags=opt.no_tags):
no_tags=opt.no_tags, submodules=opt.submodules):
r = m.GetRemote(m.remote.name)
print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
@ -253,7 +259,7 @@ to update the working directory files.
m.MetaBranchSwitch()
syncbuf = SyncBuffer(m.config)
m.Sync_LocalHalf(syncbuf)
m.Sync_LocalHalf(syncbuf, submodules=opt.submodules)
syncbuf.Finish()
if is_new or m.CurrentBranch is None:

View File

@ -723,11 +723,12 @@ later is required to fix a server side protocol bug.
mp.Sync_NetworkHalf(quiet=opt.quiet,
current_branch_only=opt.current_branch_only,
no_tags=opt.no_tags,
optimized_fetch=opt.optimized_fetch)
optimized_fetch=opt.optimized_fetch,
submodules=self.manifest.HasSubmodules)
if mp.HasChanges:
syncbuf = SyncBuffer(mp.config)
mp.Sync_LocalHalf(syncbuf)
mp.Sync_LocalHalf(syncbuf, submodules=self.manifest.HasSubmodules)
if not syncbuf.Finish():
sys.exit(1)
self._ReloadManifest(manifest_name)