diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/sync.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 5b3dca78..f8094738 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -114,6 +114,9 @@ resumeable bundle file on a content delivery network. This | |||
| 114 | may be necessary if there are problems with the local Python | 114 | may be necessary if there are problems with the local Python |
| 115 | HTTP client or proxy configuration, but the Git binary works. | 115 | HTTP client or proxy configuration, but the Git binary works. |
| 116 | 116 | ||
| 117 | The --fetch-submodules option enables fetching Git submodules | ||
| 118 | of a project from server. | ||
| 119 | |||
| 117 | SSH Connections | 120 | SSH Connections |
| 118 | --------------- | 121 | --------------- |
| 119 | 122 | ||
| @@ -180,6 +183,9 @@ later is required to fix a server side protocol bug. | |||
| 180 | p.add_option('-p', '--manifest-server-password', action='store', | 183 | p.add_option('-p', '--manifest-server-password', action='store', |
| 181 | dest='manifest_server_password', | 184 | dest='manifest_server_password', |
| 182 | help='password to authenticate with the manifest server') | 185 | help='password to authenticate with the manifest server') |
| 186 | p.add_option('--fetch-submodules', | ||
| 187 | dest='fetch_submodules', action='store_true', | ||
| 188 | help='fetch submodules from server') | ||
| 183 | if show_smart: | 189 | if show_smart: |
| 184 | p.add_option('-s', '--smart-sync', | 190 | p.add_option('-s', '--smart-sync', |
| 185 | dest='smart_sync', action='store_true', | 191 | dest='smart_sync', action='store_true', |
| @@ -559,7 +565,9 @@ later is required to fix a server side protocol bug. | |||
| 559 | self.manifest._Unload() | 565 | self.manifest._Unload() |
| 560 | if opt.jobs is None: | 566 | if opt.jobs is None: |
| 561 | self.jobs = self.manifest.default.sync_j | 567 | self.jobs = self.manifest.default.sync_j |
| 562 | all_projects = self.GetProjects(args, missing_ok=True) | 568 | all_projects = self.GetProjects(args, |
| 569 | missing_ok=True, | ||
| 570 | submodules_ok=opt.fetch_submodules) | ||
| 563 | 571 | ||
| 564 | self._fetch_times = _FetchTimes(self.manifest) | 572 | self._fetch_times = _FetchTimes(self.manifest) |
| 565 | if not opt.local_only: | 573 | if not opt.local_only: |
| @@ -570,12 +578,33 @@ later is required to fix a server side protocol bug. | |||
| 570 | to_fetch.extend(all_projects) | 578 | to_fetch.extend(all_projects) |
| 571 | to_fetch.sort(key=self._fetch_times.Get, reverse=True) | 579 | to_fetch.sort(key=self._fetch_times.Get, reverse=True) |
| 572 | 580 | ||
| 573 | self._Fetch(to_fetch, opt) | 581 | fetched = self._Fetch(to_fetch, opt) |
| 574 | _PostRepoFetch(rp, opt.no_repo_verify) | 582 | _PostRepoFetch(rp, opt.no_repo_verify) |
| 575 | if opt.network_only: | 583 | if opt.network_only: |
| 576 | # bail out now; the rest touches the working tree | 584 | # bail out now; the rest touches the working tree |
| 577 | return | 585 | return |
| 578 | 586 | ||
| 587 | # Iteratively fetch missing and/or nested unregistered submodules | ||
| 588 | previously_missing_set = set() | ||
| 589 | while True: | ||
| 590 | self.manifest._Unload() | ||
| 591 | all_projects = self.GetProjects(args, | ||
| 592 | missing_ok=True, | ||
| 593 | submodules_ok=opt.fetch_submodules) | ||
| 594 | missing = [] | ||
| 595 | for project in all_projects: | ||
| 596 | if project.gitdir not in fetched: | ||
| 597 | missing.append(project) | ||
| 598 | if not missing: | ||
| 599 | break | ||
| 600 | # Stop us from non-stopped fetching actually-missing repos: If set of | ||
| 601 | # missing repos has not been changed from last fetch, we break. | ||
| 602 | missing_set = set(p.name for p in missing) | ||
| 603 | if previously_missing_set == missing_set: | ||
| 604 | break | ||
| 605 | previously_missing_set = missing_set | ||
| 606 | fetched.update(self._Fetch(missing, opt)) | ||
| 607 | |||
| 579 | if self.manifest.IsMirror: | 608 | if self.manifest.IsMirror: |
| 580 | # bail out now, we have no working tree | 609 | # bail out now, we have no working tree |
| 581 | return | 610 | return |
