diff options
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index a4ca344a..15f69f7b 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -44,8 +44,9 @@ try: | |||
44 | except ImportError: | 44 | except ImportError: |
45 | multiprocessing = None | 45 | multiprocessing = None |
46 | 46 | ||
47 | from git_command import GIT | 47 | from git_command import GIT, git_require |
48 | from git_refs import R_HEADS, HEAD | 48 | from git_refs import R_HEADS, HEAD |
49 | from main import WrapperModule | ||
49 | from project import Project | 50 | from project import Project |
50 | from project import RemoteSpec | 51 | from project import RemoteSpec |
51 | from command import Command, MirrorSafeCommand | 52 | from command import Command, MirrorSafeCommand |
@@ -309,7 +310,8 @@ later is required to fix a server side protocol bug. | |||
309 | return fetched | 310 | return fetched |
310 | 311 | ||
311 | def _GCProjects(self, projects): | 312 | def _GCProjects(self, projects): |
312 | if multiprocessing: | 313 | has_dash_c = git_require((1, 7, 2)) |
314 | if multiprocessing and has_dash_c: | ||
313 | cpu_count = multiprocessing.cpu_count() | 315 | cpu_count = multiprocessing.cpu_count() |
314 | else: | 316 | else: |
315 | cpu_count = 1 | 317 | cpu_count = 1 |
@@ -537,7 +539,7 @@ uncommitted changes are present' % project.relpath | |||
537 | mp.PreSync() | 539 | mp.PreSync() |
538 | 540 | ||
539 | if opt.repo_upgraded: | 541 | if opt.repo_upgraded: |
540 | _PostRepoUpgrade(self.manifest) | 542 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) |
541 | 543 | ||
542 | if not opt.local_only: | 544 | if not opt.local_only: |
543 | mp.Sync_NetworkHalf(quiet=opt.quiet, | 545 | mp.Sync_NetworkHalf(quiet=opt.quiet, |
@@ -562,31 +564,12 @@ uncommitted changes are present' % project.relpath | |||
562 | to_fetch.extend(all_projects) | 564 | to_fetch.extend(all_projects) |
563 | to_fetch.sort(key=self._fetch_times.Get, reverse=True) | 565 | to_fetch.sort(key=self._fetch_times.Get, reverse=True) |
564 | 566 | ||
565 | fetched = self._Fetch(to_fetch, opt) | 567 | self._Fetch(to_fetch, opt) |
566 | _PostRepoFetch(rp, opt.no_repo_verify) | 568 | _PostRepoFetch(rp, opt.no_repo_verify) |
567 | if opt.network_only: | 569 | if opt.network_only: |
568 | # bail out now; the rest touches the working tree | 570 | # bail out now; the rest touches the working tree |
569 | return | 571 | return |
570 | 572 | ||
571 | # Iteratively fetch missing and/or nested unregistered submodules | ||
572 | previously_missing_set = set() | ||
573 | while True: | ||
574 | self.manifest._Unload() | ||
575 | all_projects = self.GetProjects(args, missing_ok=True) | ||
576 | missing = [] | ||
577 | for project in all_projects: | ||
578 | if project.gitdir not in fetched: | ||
579 | missing.append(project) | ||
580 | if not missing: | ||
581 | break | ||
582 | # Stop us from non-stopped fetching actually-missing repos: If set of | ||
583 | # missing repos has not been changed from last fetch, we break. | ||
584 | missing_set = set(p.name for p in missing) | ||
585 | if previously_missing_set == missing_set: | ||
586 | break | ||
587 | previously_missing_set = missing_set | ||
588 | fetched.update(self._Fetch(missing, opt)) | ||
589 | |||
590 | if self.manifest.IsMirror: | 573 | if self.manifest.IsMirror: |
591 | # bail out now, we have no working tree | 574 | # bail out now, we have no working tree |
592 | return | 575 | return |
@@ -611,7 +594,10 @@ uncommitted changes are present' % project.relpath | |||
611 | if self.manifest.notice: | 594 | if self.manifest.notice: |
612 | print self.manifest.notice | 595 | print self.manifest.notice |
613 | 596 | ||
614 | def _PostRepoUpgrade(manifest): | 597 | def _PostRepoUpgrade(manifest, quiet=False): |
598 | wrapper = WrapperModule() | ||
599 | if wrapper.NeedSetupGnuPG(): | ||
600 | wrapper.SetupGnuPG(quiet) | ||
615 | for project in manifest.projects.values(): | 601 | for project in manifest.projects.values(): |
616 | if project.Exists: | 602 | if project.Exists: |
617 | project.PostRepoUpgrade() | 603 | project.PostRepoUpgrade() |
@@ -711,7 +697,7 @@ class _FetchTimes(object): | |||
711 | try: | 697 | try: |
712 | try: | 698 | try: |
713 | self._times = pickle.load(f) | 699 | self._times = pickle.load(f) |
714 | except: | 700 | except IOError: |
715 | try: | 701 | try: |
716 | os.remove(self._path) | 702 | os.remove(self._path) |
717 | except OSError: | 703 | except OSError: |