summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py41
1 files changed, 3 insertions, 38 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 13085fae..2cb3ff38 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -32,7 +32,7 @@ from wrapper import Wrapper
32 32
33class Init(InteractiveCommand, MirrorSafeCommand): 33class Init(InteractiveCommand, MirrorSafeCommand):
34 COMMON = True 34 COMMON = True
35 MULTI_MANIFEST_SUPPORT = False 35 MULTI_MANIFEST_SUPPORT = True
36 helpSummary = "Initialize a repo client checkout in the current directory" 36 helpSummary = "Initialize a repo client checkout in the current directory"
37 helpUsage = """ 37 helpUsage = """
38%prog [options] [manifest url] 38%prog [options] [manifest url]
@@ -107,26 +107,6 @@ to update the working directory files.
107 return {'REPO_MANIFEST_URL': 'manifest_url', 107 return {'REPO_MANIFEST_URL': 'manifest_url',
108 'REPO_MIRROR_LOCATION': 'reference'} 108 'REPO_MIRROR_LOCATION': 'reference'}
109 109
110 def _CloneSuperproject(self, opt):
111 """Clone the superproject based on the superproject's url and branch.
112
113 Args:
114 opt: Program options returned from optparse. See _Options().
115 """
116 superproject = git_superproject.Superproject(self.manifest,
117 self.repodir,
118 self.git_event_log,
119 quiet=opt.quiet)
120 sync_result = superproject.Sync()
121 if not sync_result.success:
122 print('warning: git update of superproject failed, repo sync will not '
123 'use superproject to fetch source; while this error is not fatal, '
124 'and you can continue to run repo sync, please run repo init with '
125 'the --no-use-superproject option to stop seeing this warning',
126 file=sys.stderr)
127 if sync_result.fatal and opt.use_superproject is not None:
128 sys.exit(1)
129
130 def _SyncManifest(self, opt): 110 def _SyncManifest(self, opt):
131 """Call manifestProject.Sync with arguments from opt. 111 """Call manifestProject.Sync with arguments from opt.
132 112
@@ -154,19 +134,8 @@ to update the working directory files.
154 verbose=opt.verbose, 134 verbose=opt.verbose,
155 current_branch_only=opt.current_branch_only, 135 current_branch_only=opt.current_branch_only,
156 tags=opt.tags, 136 tags=opt.tags,
157 depth=opt.depth): 137 depth=opt.depth,
158 sys.exit(1) 138 manifest_name=opt.manifest_name):
159
160 def _LinkManifest(self, name):
161 if not name:
162 print('fatal: manifest name (-m) is required.', file=sys.stderr)
163 sys.exit(1)
164
165 try:
166 self.manifest.Link(name)
167 except ManifestParseError as e:
168 print("fatal: manifest '%s' not available" % name, file=sys.stderr)
169 print('fatal: %s' % str(e), file=sys.stderr)
170 sys.exit(1) 139 sys.exit(1)
171 140
172 def _Prompt(self, prompt, value): 141 def _Prompt(self, prompt, value):
@@ -343,10 +312,6 @@ to update the working directory files.
343 git_require((2, 15, 0), fail=True, msg='git gc worktree corruption') 312 git_require((2, 15, 0), fail=True, msg='git gc worktree corruption')
344 313
345 self._SyncManifest(opt) 314 self._SyncManifest(opt)
346 self._LinkManifest(opt.manifest_name)
347
348 if self.manifest.manifestProject.use_superproject:
349 self._CloneSuperproject(opt)
350 315
351 if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: 316 if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
352 if opt.config_name or self._ShouldConfigureUser(opt): 317 if opt.config_name or self._ShouldConfigureUser(opt):