diff options
Diffstat (limited to 'subcmds/start.py')
-rw-r--r-- | subcmds/start.py | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/subcmds/start.py b/subcmds/start.py index 60ad41e0..940c3413 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
@@ -14,11 +14,15 @@ | |||
14 | # limitations under the License. | 14 | # limitations under the License. |
15 | 15 | ||
16 | from __future__ import print_function | 16 | from __future__ import print_function |
17 | import os | ||
17 | import sys | 18 | import sys |
19 | |||
18 | from command import Command | 20 | from command import Command |
19 | from git_config import IsId | 21 | from git_config import IsId |
20 | from git_command import git | 22 | from git_command import git |
23 | import gitc_utils | ||
21 | from progress import Progress | 24 | from progress import Progress |
25 | from project import SyncBuffer | ||
22 | 26 | ||
23 | class Start(Command): | 27 | class Start(Command): |
24 | common = True | 28 | common = True |
@@ -53,20 +57,50 @@ revision specified in the manifest. | |||
53 | print("error: at least one project must be specified", file=sys.stderr) | 57 | print("error: at least one project must be specified", file=sys.stderr) |
54 | sys.exit(1) | 58 | sys.exit(1) |
55 | 59 | ||
56 | all_projects = self.GetProjects(projects) | 60 | if self.gitc_manifest: |
61 | all_projects = self.GetProjects(projects, manifest=self.gitc_manifest, | ||
62 | missing_ok=True) | ||
63 | for project in all_projects: | ||
64 | if project.old_revision: | ||
65 | project.already_synced = True | ||
66 | else: | ||
67 | project.already_synced = False | ||
68 | project.old_revision = project.revisionExpr | ||
69 | project.revisionExpr = None | ||
70 | # Save the GITC manifest. | ||
71 | gitc_utils.save_manifest(self.gitc_manifest) | ||
57 | 72 | ||
73 | all_projects = self.GetProjects(projects, | ||
74 | missing_ok=bool(self.gitc_manifest)) | ||
58 | pm = Progress('Starting %s' % nb, len(all_projects)) | 75 | pm = Progress('Starting %s' % nb, len(all_projects)) |
59 | for project in all_projects: | 76 | for project in all_projects: |
60 | pm.update() | 77 | pm.update() |
78 | |||
79 | if self.gitc_manifest: | ||
80 | gitc_project = self.gitc_manifest.paths[project.relpath] | ||
81 | # Sync projects that have not been opened. | ||
82 | if not gitc_project.already_synced: | ||
83 | proj_localdir = os.path.join(self.gitc_manifest.gitc_client_dir, | ||
84 | project.relpath) | ||
85 | project.worktree = proj_localdir | ||
86 | if not os.path.exists(proj_localdir): | ||
87 | os.makedirs(proj_localdir) | ||
88 | project.Sync_NetworkHalf() | ||
89 | sync_buf = SyncBuffer(self.manifest.manifestProject.config) | ||
90 | project.Sync_LocalHalf(sync_buf) | ||
91 | project.revisionId = gitc_project.old_revision | ||
92 | |||
61 | # If the current revision is a specific SHA1 then we can't push back | 93 | # If the current revision is a specific SHA1 then we can't push back |
62 | # to it; so substitute with dest_branch if defined, or with manifest | 94 | # to it; so substitute with dest_branch if defined, or with manifest |
63 | # default revision instead. | 95 | # default revision instead. |
96 | branch_merge = '' | ||
64 | if IsId(project.revisionExpr): | 97 | if IsId(project.revisionExpr): |
65 | if project.dest_branch: | 98 | if project.dest_branch: |
66 | project.revisionExpr = project.dest_branch | 99 | branch_merge = project.dest_branch |
67 | else: | 100 | else: |
68 | project.revisionExpr = self.manifest.default.revisionExpr | 101 | branch_merge = self.manifest.default.revisionExpr |
69 | if not project.StartBranch(nb): | 102 | |
103 | if not project.StartBranch(nb, branch_merge=branch_merge): | ||
70 | err.append(project) | 104 | err.append(project) |
71 | pm.end() | 105 | pm.end() |
72 | 106 | ||