summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 1d16c856..ab0faff3 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -32,9 +32,9 @@ from wrapper import Wrapper
32 32
33class Init(InteractiveCommand, MirrorSafeCommand): 33class Init(InteractiveCommand, MirrorSafeCommand):
34 common = True 34 common = True
35 helpSummary = "Initialize repo in the current directory" 35 helpSummary = "Initialize a repo client checkout in the current directory"
36 helpUsage = """ 36 helpUsage = """
37%prog [options] 37%prog [options] [manifest url]
38""" 38"""
39 helpDescription = """ 39 helpDescription = """
40The '%prog' command is run once to install and initialize repo. 40The '%prog' command is run once to install and initialize repo.
@@ -42,6 +42,10 @@ The latest repo source code and manifest collection is downloaded
42from the server and is installed in the .repo/ directory in the 42from the server and is installed in the .repo/ directory in the
43current working directory. 43current working directory.
44 44
45When creating a new checkout, the manifest URL is the only required setting.
46It may be specified using the --manifest-url option, or as the first optional
47argument.
48
45The optional -b argument can be used to select the manifest branch 49The optional -b argument can be used to select the manifest branch
46to 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
47branch is used. 51branch is used.
@@ -196,7 +200,7 @@ to update the working directory files.
196 200
197 if is_new: 201 if is_new:
198 if not opt.manifest_url: 202 if not opt.manifest_url:
199 print('fatal: manifest url (-u) is required.', file=sys.stderr) 203 print('fatal: manifest url is required.', file=sys.stderr)
200 sys.exit(1) 204 sys.exit(1)
201 205
202 if not opt.quiet: 206 if not opt.quiet:
@@ -498,7 +502,15 @@ to update the working directory files.
498 self.OptionParser.error('--mirror and --archive cannot be used together.') 502 self.OptionParser.error('--mirror and --archive cannot be used together.')
499 503
500 if args: 504 if args:
501 self.OptionParser.error('init takes no arguments') 505 if opt.manifest_url:
506 self.OptionParser.error(
507 '--manifest-url option and URL argument both specified: only use '
508 'one to select the manifest URL.')
509
510 opt.manifest_url = args.pop(0)
511
512 if args:
513 self.OptionParser.error('too many arguments to init')
502 514
503 def Execute(self, opt, args): 515 def Execute(self, opt, args):
504 git_require(MIN_GIT_VERSION_HARD, fail=True) 516 git_require(MIN_GIT_VERSION_HARD, fail=True)