summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_superproject.py24
-rw-r--r--subcmds/init.py3
-rw-r--r--subcmds/sync.py8
3 files changed, 25 insertions, 10 deletions
diff --git a/git_superproject.py b/git_superproject.py
index 1293f352..07bc2645 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -415,16 +415,26 @@ def _UseSuperprojectFromConfiguration():
415 return False 415 return False
416 416
417 417
418def PrintMessages(opt, manifest): 418def PrintMessages(use_superproject, manifest):
419 """Returns a boolean if error/warning messages are to be printed.""" 419 """Returns a boolean if error/warning messages are to be printed.
420 return opt.use_superproject is not None or bool(manifest.superproject) 420
421 Args:
422 use_superproject: option value from optparse.
423 manifest: manifest to use.
424 """
425 return use_superproject is not None or bool(manifest.superproject)
421 426
422 427
423def UseSuperproject(opt, manifest): 428def UseSuperproject(use_superproject, manifest):
424 """Returns a boolean if use-superproject option is enabled.""" 429 """Returns a boolean if use-superproject option is enabled.
430
431 Args:
432 use_superproject: option value from optparse.
433 manifest: manifest to use.
434 """
425 435
426 if opt.use_superproject is not None: 436 if use_superproject is not None:
427 return opt.use_superproject 437 return use_superproject
428 else: 438 else:
429 client_value = manifest.manifestProject.use_superproject 439 client_value = manifest.manifestProject.use_superproject
430 if client_value is not None: 440 if client_value is not None:
diff --git a/subcmds/init.py b/subcmds/init.py
index 99f30dce..0388f5d1 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -260,6 +260,9 @@ to update the working directory files.
260 if opt.use_superproject is not None: 260 if opt.use_superproject is not None:
261 self.OptionParser.error('--mirror and --use-superproject cannot be ' 261 self.OptionParser.error('--mirror and --use-superproject cannot be '
262 'used together.') 262 'used together.')
263 if opt.archive and opt.use_superproject is not None:
264 self.OptionParser.error('--archive and --use-superproject cannot be used '
265 'together.')
263 266
264 if opt.standalone_manifest and (opt.manifest_branch or 267 if opt.standalone_manifest and (opt.manifest_branch or
265 opt.manifest_name != 'default.xml'): 268 opt.manifest_name != 'default.xml'):
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 4d0a5ec6..3451ab6b 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -286,7 +286,7 @@ later is required to fix a server side protocol bug.
286 True if a superproject is requested, otherwise the value of the 286 True if a superproject is requested, otherwise the value of the
287 current_branch option (True, False or None). 287 current_branch option (True, False or None).
288 """ 288 """
289 return git_superproject.UseSuperproject(opt, self.manifest) or opt.current_branch_only 289 return git_superproject.UseSuperproject(opt.use_superproject, self.manifest) or opt.current_branch_only
290 290
291 def _UpdateProjectsRevisionId(self, opt, args, load_local_manifests, superproject_logging_data): 291 def _UpdateProjectsRevisionId(self, opt, args, load_local_manifests, superproject_logging_data):
292 """Update revisionId of every project with the SHA from superproject. 292 """Update revisionId of every project with the SHA from superproject.
@@ -306,7 +306,8 @@ later is required to fix a server side protocol bug.
306 """ 306 """
307 superproject = self.manifest.superproject 307 superproject = self.manifest.superproject
308 superproject.SetQuiet(opt.quiet) 308 superproject.SetQuiet(opt.quiet)
309 print_messages = git_superproject.PrintMessages(opt, self.manifest) 309 print_messages = git_superproject.PrintMessages(opt.use_superproject,
310 self.manifest)
310 superproject.SetPrintMessages(print_messages) 311 superproject.SetPrintMessages(print_messages)
311 if opt.local_only: 312 if opt.local_only:
312 manifest_path = superproject.manifest_path 313 manifest_path = superproject.manifest_path
@@ -993,7 +994,8 @@ later is required to fix a server side protocol bug.
993 self._UpdateManifestProject(opt, mp, manifest_name) 994 self._UpdateManifestProject(opt, mp, manifest_name)
994 995
995 load_local_manifests = not self.manifest.HasLocalManifests 996 load_local_manifests = not self.manifest.HasLocalManifests
996 use_superproject = git_superproject.UseSuperproject(opt, self.manifest) 997 use_superproject = git_superproject.UseSuperproject(opt.use_superproject,
998 self.manifest)
997 if use_superproject and (self.manifest.IsMirror or self.manifest.IsArchive): 999 if use_superproject and (self.manifest.IsMirror or self.manifest.IsArchive):
998 # Don't use superproject, because we have no working tree. 1000 # Don't use superproject, because we have no working tree.
999 use_superproject = False 1001 use_superproject = False