summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 41578076..5ba0d074 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -54,7 +54,8 @@ from the server and is installed in the .repo/ directory in the
54current working directory. 54current working directory.
55 55
56The optional -b argument can be used to select the manifest branch 56The optional -b argument can be used to select the manifest branch
57to checkout and use. If no branch is specified, master is assumed. 57to checkout and use. If no branch is specified, the remote's default
58branch is used.
58 59
59The optional -m argument can be used to specify an alternate manifest 60The optional -m argument can be used to specify an alternate manifest
60to be used. If no manifest is specified, the manifest default.xml 61to be used. If no manifest is specified, the manifest default.xml
@@ -215,24 +216,27 @@ to update the working directory files.
215 216
216 m._InitGitDir(mirror_git=mirrored_manifest_git) 217 m._InitGitDir(mirror_git=mirrored_manifest_git)
217 218
218 if opt.manifest_branch:
219 m.revisionExpr = opt.manifest_branch
220 else:
221 m.revisionExpr = 'refs/heads/master'
222 else:
223 if opt.manifest_branch:
224 m.revisionExpr = opt.manifest_branch
225 else:
226 m.PreSync()
227
228 self._ConfigureDepth(opt) 219 self._ConfigureDepth(opt)
229 220
221 # Set the remote URL before the remote branch as we might need it below.
230 if opt.manifest_url: 222 if opt.manifest_url:
231 r = m.GetRemote(m.remote.name) 223 r = m.GetRemote(m.remote.name)
232 r.url = opt.manifest_url 224 r.url = opt.manifest_url
233 r.ResetFetch() 225 r.ResetFetch()
234 r.Save() 226 r.Save()
235 227
228 if opt.manifest_branch:
229 m.revisionExpr = opt.manifest_branch
230 else:
231 if is_new:
232 default_branch = m.ResolveRemoteHead()
233 if default_branch is None:
234 # If the remote doesn't have HEAD configured, default to master.
235 default_branch = 'refs/heads/master'
236 m.revisionExpr = default_branch
237 else:
238 m.PreSync()
239
236 groups = re.split(r'[,\s]+', opt.groups) 240 groups = re.split(r'[,\s]+', opt.groups)
237 all_platforms = ['linux', 'darwin', 'windows'] 241 all_platforms = ['linux', 'darwin', 'windows']
238 platformize = lambda x: 'platform-' + x 242 platformize = lambda x: 'platform-' + x