summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/init.py20
-rw-r--r--subcmds/sync.py22
2 files changed, 23 insertions, 19 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
25from project import SyncBuffer 25from project import SyncBuffer
26from git_config import GitConfig 26from git_config import GitConfig
27from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD 27from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD
28import git_superproject
28import platform_utils 29import platform_utils
29from wrapper import Wrapper 30from 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)
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 5020ea7a..eda95f96 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -294,28 +294,12 @@ later is required to fix a server side protocol bug.
294 Returns: 294 Returns:
295 Returns path to the overriding manifest file. 295 Returns path to the overriding manifest file.
296 """ 296 """
297 if not self.manifest.superproject: 297 superproject = git_superproject.Superproject(self.manifest,
298 print('error: superproject tag is not defined in manifest.xml', 298 self.repodir)
299 file=sys.stderr)
300 sys.exit(1)
301 print('WARNING: --use-superproject is experimental and not '
302 'for general use', file=sys.stderr)
303
304 superproject_url = self.manifest.superproject['remote'].url
305 if not superproject_url:
306 print('error: superproject URL is not defined in manifest.xml',
307 file=sys.stderr)
308 sys.exit(1)
309
310 superproject = git_superproject.Superproject(self.manifest.repodir)
311 all_projects = self.GetProjects(args, 299 all_projects = self.GetProjects(args,
312 missing_ok=True, 300 missing_ok=True,
313 submodules_ok=opt.fetch_submodules) 301 submodules_ok=opt.fetch_submodules)
314 branch = self._GetBranch() 302 manifest_path = superproject.UpdateProjectsRevisionId(all_projects)
315 manifest_path = superproject.UpdateProjectsRevisionId(self.manifest,
316 all_projects,
317 url=superproject_url,
318 branch=branch)
319 if not manifest_path: 303 if not manifest_path:
320 print('error: Update of revsionId from superproject has failed', 304 print('error: Update of revsionId from superproject has failed',
321 file=sys.stderr) 305 file=sys.stderr)