diff options
Diffstat (limited to 'subcmds/init.py')
-rw-r--r-- | subcmds/init.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index fe3ebd2c..1d16c856 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -25,6 +25,7 @@ from error import ManifestParseError | |||
25 | from project import SyncBuffer | 25 | from project import SyncBuffer |
26 | from git_config import GitConfig | 26 | from git_config import GitConfig |
27 | from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD | 27 | from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD |
28 | import git_superproject | ||
28 | import platform_utils | 29 | import platform_utils |
29 | from wrapper import Wrapper | 30 | from wrapper import Wrapper |
30 | 31 | ||
@@ -134,6 +135,11 @@ to update the working directory files. | |||
134 | g.add_option('--submodules', | 135 | g.add_option('--submodules', |
135 | dest='submodules', action='store_true', | 136 | dest='submodules', action='store_true', |
136 | help='sync any submodules associated with the manifest repo') | 137 | help='sync any submodules associated with the manifest repo') |
138 | g.add_option('--use-superproject', action='store_true', | ||
139 | help='use the manifest superproject to sync projects') | ||
140 | g.add_option('--no-use-superproject', action='store_false', | ||
141 | dest='use_superproject', | ||
142 | help='disable use of manifest superprojects') | ||
137 | g.add_option('-g', '--groups', | 143 | g.add_option('-g', '--groups', |
138 | dest='groups', default='default', | 144 | dest='groups', default='default', |
139 | help='restrict manifest projects to ones with specified ' | 145 | help='restrict manifest projects to ones with specified ' |
@@ -176,6 +182,14 @@ to update the working directory files. | |||
176 | return {'REPO_MANIFEST_URL': 'manifest_url', | 182 | return {'REPO_MANIFEST_URL': 'manifest_url', |
177 | 'REPO_MIRROR_LOCATION': 'reference'} | 183 | 'REPO_MIRROR_LOCATION': 'reference'} |
178 | 184 | ||
185 | def _CloneSuperproject(self): | ||
186 | """Clone the superproject based on the superproject's url and branch.""" | ||
187 | superproject = git_superproject.Superproject(self.manifest, | ||
188 | self.repodir) | ||
189 | if not superproject.Sync(): | ||
190 | print('error: git update of superproject failed', file=sys.stderr) | ||
191 | sys.exit(1) | ||
192 | |||
179 | def _SyncManifest(self, opt): | 193 | def _SyncManifest(self, opt): |
180 | m = self.manifest.manifestProject | 194 | m = self.manifest.manifestProject |
181 | is_new = not m.Exists | 195 | is_new = not m.Exists |
@@ -305,6 +319,9 @@ to update the working directory files. | |||
305 | if opt.submodules: | 319 | if opt.submodules: |
306 | m.config.SetBoolean('repo.submodules', opt.submodules) | 320 | m.config.SetBoolean('repo.submodules', opt.submodules) |
307 | 321 | ||
322 | if opt.use_superproject is not None: | ||
323 | m.config.SetBoolean('repo.superproject', opt.use_superproject) | ||
324 | |||
308 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, verbose=opt.verbose, | 325 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, verbose=opt.verbose, |
309 | clone_bundle=opt.clone_bundle, | 326 | clone_bundle=opt.clone_bundle, |
310 | current_branch_only=opt.current_branch_only, | 327 | current_branch_only=opt.current_branch_only, |
@@ -519,6 +536,9 @@ to update the working directory files. | |||
519 | self._SyncManifest(opt) | 536 | self._SyncManifest(opt) |
520 | self._LinkManifest(opt.manifest_name) | 537 | self._LinkManifest(opt.manifest_name) |
521 | 538 | ||
539 | if self.manifest.manifestProject.config.GetBoolean('repo.superproject'): | ||
540 | self._CloneSuperproject() | ||
541 | |||
522 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: | 542 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: |
523 | if opt.config_name or self._ShouldConfigureUser(opt): | 543 | if opt.config_name or self._ShouldConfigureUser(opt): |
524 | self._ConfigureUser(opt) | 544 | self._ConfigureUser(opt) |