diff options
Diffstat (limited to 'subcmds/start.py')
-rw-r--r-- | subcmds/start.py | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/subcmds/start.py b/subcmds/start.py index 67ac7df9..481d9ef2 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
@@ -13,15 +13,13 @@ | |||
13 | # limitations under the License. | 13 | # limitations under the License. |
14 | 14 | ||
15 | import functools | 15 | import functools |
16 | import os | ||
17 | import sys | 16 | import sys |
18 | 17 | ||
19 | from command import Command, DEFAULT_LOCAL_JOBS | 18 | from command import Command, DEFAULT_LOCAL_JOBS |
20 | from git_config import IsImmutable | 19 | from git_config import IsImmutable |
21 | from git_command import git | 20 | from git_command import git |
22 | import gitc_utils | ||
23 | from progress import Progress | 21 | from progress import Progress |
24 | from project import SyncBuffer, Project | 22 | from project import Project |
25 | from typing import NamedTuple | 23 | from typing import NamedTuple |
26 | from error import RepoExitError | 24 | from error import RepoExitError |
27 | 25 | ||
@@ -115,49 +113,9 @@ revision specified in the manifest. | |||
115 | 113 | ||
116 | all_projects = self.GetProjects( | 114 | all_projects = self.GetProjects( |
117 | projects, | 115 | projects, |
118 | missing_ok=bool(self.gitc_manifest), | ||
119 | all_manifests=not opt.this_manifest_only, | 116 | all_manifests=not opt.this_manifest_only, |
120 | ) | 117 | ) |
121 | 118 | ||
122 | # This must happen after we find all_projects, since GetProjects may | ||
123 | # need the local directory, which will disappear once we save the GITC | ||
124 | # manifest. | ||
125 | if self.gitc_manifest: | ||
126 | gitc_projects = self.GetProjects( | ||
127 | projects, manifest=self.gitc_manifest, missing_ok=True | ||
128 | ) | ||
129 | for project in gitc_projects: | ||
130 | if project.old_revision: | ||
131 | project.already_synced = True | ||
132 | else: | ||
133 | project.already_synced = False | ||
134 | project.old_revision = project.revisionExpr | ||
135 | project.revisionExpr = None | ||
136 | # Save the GITC manifest. | ||
137 | gitc_utils.save_manifest(self.gitc_manifest) | ||
138 | |||
139 | # Make sure we have a valid CWD. | ||
140 | if not os.path.exists(os.getcwd()): | ||
141 | os.chdir(self.manifest.topdir) | ||
142 | |||
143 | pm = Progress("Syncing %s" % nb, len(all_projects), quiet=opt.quiet) | ||
144 | for project in all_projects: | ||
145 | gitc_project = self.gitc_manifest.paths[project.relpath] | ||
146 | # Sync projects that have not been opened. | ||
147 | if not gitc_project.already_synced: | ||
148 | proj_localdir = os.path.join( | ||
149 | self.gitc_manifest.gitc_client_dir, project.relpath | ||
150 | ) | ||
151 | project.worktree = proj_localdir | ||
152 | if not os.path.exists(proj_localdir): | ||
153 | os.makedirs(proj_localdir) | ||
154 | project.Sync_NetworkHalf() | ||
155 | sync_buf = SyncBuffer(self.manifest.manifestProject.config) | ||
156 | project.Sync_LocalHalf(sync_buf) | ||
157 | project.revisionId = gitc_project.old_revision | ||
158 | pm.update(msg="") | ||
159 | pm.end() | ||
160 | |||
161 | def _ProcessResults(_pool, pm, results): | 119 | def _ProcessResults(_pool, pm, results): |
162 | for result in results: | 120 | for result in results: |
163 | if result.error: | 121 | if result.error: |