diff --git a/repo_launcher b/repo_launcher index 7b6673a73..a4eb43fde 100755 --- a/repo_launcher +++ b/repo_launcher @@ -149,7 +149,7 @@ if not REPO_REV: BUG_URL = 'https://bugs.chromium.org/p/gerrit/issues/entry?template=Repo+tool+issue' # increment this whenever we make important changes to this script -VERSION = (2, 21) +VERSION = (2, 29) # increment this if the MAINTAINER_KEYS block is modified KEYRING_VERSION = (2, 3) @@ -316,6 +316,9 @@ def InitParser(parser, gitc_init=False): help='download the manifest as a static file ' 'rather then create a git checkout of ' 'the manifest repo') + group.add_option('--manifest-depth', type='int', default=1, metavar='DEPTH', + help='create a shallow clone of the manifest repo with ' + 'given depth; see git clone (default: %default)') # Options that only affect manifest project, and not any of the projects # specified in the manifest itself. @@ -325,9 +328,9 @@ def InitParser(parser, gitc_init=False): # want -c, so try to satisfy both as best we can. if not gitc_init: cbr_opts += ['-c'] - group.add_option(*cbr_opts, + group.add_option(*cbr_opts, default=True, dest='current_branch_only', action='store_true', - help='fetch only current manifest branch from server') + help='fetch only current manifest branch from server (default)') group.add_option('--no-current-branch', dest='current_branch_only', action='store_false', help='fetch all manifest branches from server') @@ -612,15 +615,20 @@ def _Init(args, gitc_init=False): try: if not opt.quiet: print('Downloading Repo source from', url) - dst = os.path.abspath(os.path.join(repodir, S_repo)) + dst_final = os.path.abspath(os.path.join(repodir, S_repo)) + dst = dst_final + '.tmp' + shutil.rmtree(dst, ignore_errors=True) _Clone(url, dst, opt.clone_bundle, opt.quiet, opt.verbose) remote_ref, rev = check_repo_rev(dst, rev, opt.repo_verify, quiet=opt.quiet) _Checkout(dst, remote_ref, rev, opt.quiet) if not os.path.isfile(os.path.join(dst, 'repo')): - print("warning: '%s' does not look like a git-repo repository, is " - "REPO_URL set correctly?" % url, file=sys.stderr) + print("fatal: '%s' does not look like a git-repo repository, is " + "--repo-url set correctly?" % url, file=sys.stderr) + raise CloneFailure() + + os.rename(dst, dst_final) except CloneFailure: print('fatal: double check your --repo-rev setting.', file=sys.stderr) @@ -1317,6 +1325,7 @@ def main(orig_args): print("fatal: cloning the git-repo repository failed, will remove " "'%s' " % path, file=sys.stderr) shutil.rmtree(path, ignore_errors=True) + shutil.rmtree(path + '.tmp', ignore_errors=True) sys.exit(1) repo_main, rel_repo_dir = _FindRepo() else: