diff options
-rw-r--r-- | subcmds/sync.py | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index d047b162..f77a785b 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -836,6 +836,33 @@ later is required to fix a server side protocol bug. | |||
836 | 836 | ||
837 | return manifest_name | 837 | return manifest_name |
838 | 838 | ||
839 | def _UpdateManifestProject(self, opt, mp, manifest_name): | ||
840 | """Fetch & update the local manifest project.""" | ||
841 | if not opt.local_only: | ||
842 | start = time.time() | ||
843 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, | ||
844 | current_branch_only=opt.current_branch_only, | ||
845 | no_tags=opt.no_tags, | ||
846 | optimized_fetch=opt.optimized_fetch, | ||
847 | submodules=self.manifest.HasSubmodules, | ||
848 | clone_filter=self.manifest.CloneFilter) | ||
849 | finish = time.time() | ||
850 | self.event_log.AddSync(mp, event_log.TASK_SYNC_NETWORK, | ||
851 | start, finish, success) | ||
852 | |||
853 | if mp.HasChanges: | ||
854 | syncbuf = SyncBuffer(mp.config) | ||
855 | start = time.time() | ||
856 | mp.Sync_LocalHalf(syncbuf, submodules=self.manifest.HasSubmodules) | ||
857 | clean = syncbuf.Finish() | ||
858 | self.event_log.AddSync(mp, event_log.TASK_SYNC_LOCAL, | ||
859 | start, time.time(), clean) | ||
860 | if not clean: | ||
861 | sys.exit(1) | ||
862 | self._ReloadManifest(opt.manifest_name) | ||
863 | if opt.jobs is None: | ||
864 | self.jobs = self.manifest.default.sync_j | ||
865 | |||
839 | def ValidateOptions(self, opt, args): | 866 | def ValidateOptions(self, opt, args): |
840 | if opt.force_broken: | 867 | if opt.force_broken: |
841 | print('warning: -f/--force-broken is now the default behavior, and the ' | 868 | print('warning: -f/--force-broken is now the default behavior, and the ' |
@@ -887,30 +914,7 @@ later is required to fix a server side protocol bug. | |||
887 | if opt.repo_upgraded: | 914 | if opt.repo_upgraded: |
888 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) | 915 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) |
889 | 916 | ||
890 | if not opt.local_only: | 917 | self._UpdateManifestProject(opt, mp, manifest_name) |
891 | start = time.time() | ||
892 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, | ||
893 | current_branch_only=opt.current_branch_only, | ||
894 | no_tags=opt.no_tags, | ||
895 | optimized_fetch=opt.optimized_fetch, | ||
896 | submodules=self.manifest.HasSubmodules, | ||
897 | clone_filter=self.manifest.CloneFilter) | ||
898 | finish = time.time() | ||
899 | self.event_log.AddSync(mp, event_log.TASK_SYNC_NETWORK, | ||
900 | start, finish, success) | ||
901 | |||
902 | if mp.HasChanges: | ||
903 | syncbuf = SyncBuffer(mp.config) | ||
904 | start = time.time() | ||
905 | mp.Sync_LocalHalf(syncbuf, submodules=self.manifest.HasSubmodules) | ||
906 | clean = syncbuf.Finish() | ||
907 | self.event_log.AddSync(mp, event_log.TASK_SYNC_LOCAL, | ||
908 | start, time.time(), clean) | ||
909 | if not clean: | ||
910 | sys.exit(1) | ||
911 | self._ReloadManifest(manifest_name) | ||
912 | if opt.jobs is None: | ||
913 | self.jobs = self.manifest.default.sync_j | ||
914 | 918 | ||
915 | if self.gitc_manifest: | 919 | if self.gitc_manifest: |
916 | gitc_manifest_projects = self.GetProjects(args, | 920 | gitc_manifest_projects = self.GetProjects(args, |