summaryrefslogtreecommitdiffstats
path: root/repo
diff options
context:
space:
mode:
Diffstat (limited to 'repo')
-rwxr-xr-xrepo44
1 files changed, 6 insertions, 38 deletions
diff --git a/repo b/repo
index dbc96da7..b9b1928a 100755
--- a/repo
+++ b/repo
@@ -149,7 +149,7 @@ if not REPO_REV:
149BUG_URL = 'https://issues.gerritcodereview.com/issues/new?component=1370071' 149BUG_URL = 'https://issues.gerritcodereview.com/issues/new?component=1370071'
150 150
151# increment this whenever we make important changes to this script 151# increment this whenever we make important changes to this script
152VERSION = (2, 35) 152VERSION = (2, 36)
153 153
154# increment this if the MAINTAINER_KEYS block is modified 154# increment this if the MAINTAINER_KEYS block is modified
155KEYRING_VERSION = (2, 3) 155KEYRING_VERSION = (2, 3)
@@ -273,16 +273,16 @@ gpg_dir = os.path.join(home_dot_repo, 'gnupg')
273def GetParser(gitc_init=False): 273def GetParser(gitc_init=False):
274 """Setup the CLI parser.""" 274 """Setup the CLI parser."""
275 if gitc_init: 275 if gitc_init:
276 usage = 'repo gitc-init -c client [options] [-u] url' 276 sys.exit('repo: fatal: GITC not supported.')
277 else: 277 else:
278 usage = 'repo init [options] [-u] url' 278 usage = 'repo init [options] [-u] url'
279 279
280 parser = optparse.OptionParser(usage=usage) 280 parser = optparse.OptionParser(usage=usage)
281 InitParser(parser, gitc_init=gitc_init) 281 InitParser(parser)
282 return parser 282 return parser
283 283
284 284
285def InitParser(parser, gitc_init=False): 285def InitParser(parser):
286 """Setup the CLI parser.""" 286 """Setup the CLI parser."""
287 # NB: Keep in sync with command.py:_CommonOptions(). 287 # NB: Keep in sync with command.py:_CommonOptions().
288 288
@@ -325,12 +325,8 @@ def InitParser(parser, gitc_init=False):
325 # Options that only affect manifest project, and not any of the projects 325 # Options that only affect manifest project, and not any of the projects
326 # specified in the manifest itself. 326 # specified in the manifest itself.
327 group = parser.add_option_group('Manifest (only) checkout options') 327 group = parser.add_option_group('Manifest (only) checkout options')
328 cbr_opts = ['--current-branch'] 328
329 # The gitc-init subcommand allocates -c itself, but a lot of init users 329 group.add_option('--current-branch', '-c', default=True,
330 # want -c, so try to satisfy both as best we can.
331 if not gitc_init:
332 cbr_opts += ['-c']
333 group.add_option(*cbr_opts, default=True,
334 dest='current_branch_only', action='store_true', 330 dest='current_branch_only', action='store_true',
335 help='fetch only current manifest branch from server (default)') 331 help='fetch only current manifest branch from server (default)')
336 group.add_option('--no-current-branch', 332 group.add_option('--no-current-branch',
@@ -411,14 +407,6 @@ def InitParser(parser, gitc_init=False):
411 action='store_true', default=False, 407 action='store_true', default=False,
412 help='Always prompt for name/e-mail') 408 help='Always prompt for name/e-mail')
413 409
414 # gitc-init specific settings.
415 if gitc_init:
416 group = parser.add_option_group('GITC options')
417 group.add_option('-f', '--manifest-file',
418 help='Optional manifest file to use for this GITC client.')
419 group.add_option('-c', '--gitc-client',
420 help='Name of the gitc_client instance to create or modify.')
421
422 return parser 410 return parser
423 411
424 412
@@ -582,26 +570,6 @@ def _Init(args, gitc_init=False):
582 rev = opt.repo_rev or REPO_REV 570 rev = opt.repo_rev or REPO_REV
583 571
584 try: 572 try:
585 if gitc_init:
586 gitc_manifest_dir = get_gitc_manifest_dir()
587 if not gitc_manifest_dir:
588 print('fatal: GITC filesystem is not available. Exiting...',
589 file=sys.stderr)
590 sys.exit(1)
591 gitc_client = opt.gitc_client
592 if not gitc_client:
593 gitc_client = gitc_parse_clientdir(os.getcwd())
594 if not gitc_client:
595 print('fatal: GITC client (-c) is required.', file=sys.stderr)
596 sys.exit(1)
597 client_dir = os.path.join(gitc_manifest_dir, gitc_client)
598 if not os.path.exists(client_dir):
599 os.makedirs(client_dir)
600 os.chdir(client_dir)
601 if os.path.exists(repodir):
602 # This GITC Client has already initialized repo so continue.
603 return
604
605 os.mkdir(repodir) 573 os.mkdir(repodir)
606 except OSError as e: 574 except OSError as e:
607 if e.errno != errno.EEXIST: 575 if e.errno != errno.EEXIST: