summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index ab0faff3..fc446045 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -48,7 +48,7 @@ argument.
48 48
49The optional -b argument can be used to select the manifest branch 49The optional -b argument can be used to select the manifest branch
50to checkout and use. If no branch is specified, the remote's default 50to checkout and use. If no branch is specified, the remote's default
51branch is used. 51branch is used. This is equivalent to using -b HEAD.
52 52
53The optional -m argument can be used to specify an alternate manifest 53The optional -m argument can be used to specify an alternate manifest
54to be used. If no manifest is specified, the manifest default.xml 54to be used. If no manifest is specified, the manifest default.xml
@@ -94,9 +94,8 @@ to update the working directory files.
94 g.add_option('-u', '--manifest-url', 94 g.add_option('-u', '--manifest-url',
95 dest='manifest_url', 95 dest='manifest_url',
96 help='manifest repository location', metavar='URL') 96 help='manifest repository location', metavar='URL')
97 g.add_option('-b', '--manifest-branch', 97 g.add_option('-b', '--manifest-branch', metavar='REVISION',
98 dest='manifest_branch', 98 help='manifest branch or revision (use HEAD for default)')
99 help='manifest branch or revision', metavar='REVISION')
100 cbr_opts = ['--current-branch'] 99 cbr_opts = ['--current-branch']
101 # The gitc-init subcommand allocates -c itself, but a lot of init users 100 # The gitc-init subcommand allocates -c itself, but a lot of init users
102 # want -c, so try to satisfy both as best we can. 101 # want -c, so try to satisfy both as best we can.
@@ -232,6 +231,11 @@ to update the working directory files.
232 r.Save() 231 r.Save()
233 232
234 if opt.manifest_branch: 233 if opt.manifest_branch:
234 if opt.manifest_branch == 'HEAD':
235 opt.manifest_branch = m.ResolveRemoteHead()
236 if opt.manifest_branch is None:
237 print('fatal: unable to resolve HEAD', file=sys.stderr)
238 sys.exit(1)
235 m.revisionExpr = opt.manifest_branch 239 m.revisionExpr = opt.manifest_branch
236 else: 240 else:
237 if is_new: 241 if is_new: