diff options
| -rwxr-xr-x | repo | 4 | ||||
| -rw-r--r-- | subcmds/init.py | 12 |
2 files changed, 10 insertions, 6 deletions
| @@ -289,8 +289,8 @@ def GetParser(gitc_init=False): | |||
| 289 | group = parser.add_option_group('Manifest options') | 289 | group = parser.add_option_group('Manifest options') |
| 290 | group.add_option('-u', '--manifest-url', | 290 | group.add_option('-u', '--manifest-url', |
| 291 | help='manifest repository location', metavar='URL') | 291 | help='manifest repository location', metavar='URL') |
| 292 | group.add_option('-b', '--manifest-branch', | 292 | group.add_option('-b', '--manifest-branch', metavar='REVISION', |
| 293 | help='manifest branch or revision', metavar='REVISION') | 293 | help='manifest branch or revision (use HEAD for default)') |
| 294 | group.add_option('-m', '--manifest-name', | 294 | group.add_option('-m', '--manifest-name', |
| 295 | help='initial manifest file', metavar='NAME.xml') | 295 | help='initial manifest file', metavar='NAME.xml') |
| 296 | cbr_opts = ['--current-branch'] | 296 | cbr_opts = ['--current-branch'] |
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 | ||
| 49 | The optional -b argument can be used to select the manifest branch | 49 | The optional -b argument can be used to select the manifest branch |
| 50 | to checkout and use. If no branch is specified, the remote's default | 50 | to checkout and use. If no branch is specified, the remote's default |
| 51 | branch is used. | 51 | branch is used. This is equivalent to using -b HEAD. |
| 52 | 52 | ||
| 53 | The optional -m argument can be used to specify an alternate manifest | 53 | The optional -m argument can be used to specify an alternate manifest |
| 54 | to be used. If no manifest is specified, the manifest default.xml | 54 | to 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: |
