summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 0c386add..9f8de9e5 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -277,7 +277,7 @@ later is required to fix a server side protocol bug.
277 """Returns True if current-branch or use-superproject options are enabled.""" 277 """Returns True if current-branch or use-superproject options are enabled."""
278 return opt.current_branch_only or self._UseSuperproject(opt) 278 return opt.current_branch_only or self._UseSuperproject(opt)
279 279
280 def _UpdateProjectsRevisionId(self, opt, args): 280 def _UpdateProjectsRevisionId(self, opt, args, load_local_manifests):
281 """Update revisionId of every project with the SHA from superproject. 281 """Update revisionId of every project with the SHA from superproject.
282 282
283 This function updates each project's revisionId with SHA from superproject. 283 This function updates each project's revisionId with SHA from superproject.
@@ -287,6 +287,7 @@ later is required to fix a server side protocol bug.
287 opt: Program options returned from optparse. See _Options(). 287 opt: Program options returned from optparse. See _Options().
288 args: Arguments to pass to GetProjects. See the GetProjects 288 args: Arguments to pass to GetProjects. See the GetProjects
289 docstring for details. 289 docstring for details.
290 load_local_manifests: Whether to load local manifests.
290 291
291 Returns: 292 Returns:
292 Returns path to the overriding manifest file. 293 Returns path to the overriding manifest file.
@@ -302,7 +303,7 @@ later is required to fix a server side protocol bug.
302 print('error: Update of revsionId from superproject has failed', 303 print('error: Update of revsionId from superproject has failed',
303 file=sys.stderr) 304 file=sys.stderr)
304 sys.exit(1) 305 sys.exit(1)
305 self._ReloadManifest(manifest_path) 306 self._ReloadManifest(manifest_path, load_local_manifests)
306 return manifest_path 307 return manifest_path
307 308
308 def _FetchProjectList(self, opt, projects): 309 def _FetchProjectList(self, opt, projects):
@@ -565,10 +566,18 @@ later is required to fix a server side protocol bug.
565 t.join() 566 t.join()
566 pm.end() 567 pm.end()
567 568
568 def _ReloadManifest(self, manifest_name=None): 569 def _ReloadManifest(self, manifest_name=None, load_local_manifests=True):
570 """Reload the manfiest from the file specified by the |manifest_name|.
571
572 It unloads the manifest if |manifest_name| is None.
573
574 Args:
575 manifest_name: Manifest file to be reloaded.
576 load_local_manifests: Whether to load local manifests.
577 """
569 if manifest_name: 578 if manifest_name:
570 # Override calls _Unload already 579 # Override calls _Unload already
571 self.manifest.Override(manifest_name) 580 self.manifest.Override(manifest_name, load_local_manifests=load_local_manifests)
572 else: 581 else:
573 self.manifest._Unload() 582 self.manifest._Unload()
574 583
@@ -857,8 +866,9 @@ later is required to fix a server side protocol bug.
857 else: 866 else:
858 self._UpdateManifestProject(opt, mp, manifest_name) 867 self._UpdateManifestProject(opt, mp, manifest_name)
859 868
869 load_local_manifests = not self.manifest.HasLocalManifests
860 if self._UseSuperproject(opt): 870 if self._UseSuperproject(opt):
861 manifest_name = self._UpdateProjectsRevisionId(opt, args) 871 manifest_name = self._UpdateProjectsRevisionId(opt, args, load_local_manifests)
862 872
863 if self.gitc_manifest: 873 if self.gitc_manifest:
864 gitc_manifest_projects = self.GetProjects(args, 874 gitc_manifest_projects = self.GetProjects(args,
@@ -926,7 +936,7 @@ later is required to fix a server side protocol bug.
926 # Iteratively fetch missing and/or nested unregistered submodules 936 # Iteratively fetch missing and/or nested unregistered submodules
927 previously_missing_set = set() 937 previously_missing_set = set()
928 while True: 938 while True:
929 self._ReloadManifest(manifest_name) 939 self._ReloadManifest(manifest_name, load_local_manifests)
930 all_projects = self.GetProjects(args, 940 all_projects = self.GetProjects(args,
931 missing_ok=True, 941 missing_ok=True,
932 submodules_ok=opt.fetch_submodules) 942 submodules_ok=opt.fetch_submodules)