From dcbfadf814aeb31bb66a265c74ef681d9dcb4875 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 22 Feb 2020 00:04:39 -0500 Subject: [PATCH] repo/init: improve basic progress messages We produce some simple "Get" messages that aren't super clear as to what they're doing, especially for people not familiar with repo. Rephrase these to explicitly state the thing we're doing so it's clear why we're downloading a particular source. Bug: https://crbug.com/gerrit/11293 Change-Id: I0749504f17c5385c6c65274a274e0ae25b117413 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256455 Tested-by: Mike Frysinger Reviewed-by: David Pursehouse --- repo | 12 +++++++----- subcmds/init.py | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/repo b/repo index 25ed328..8b05def 100755 --- a/repo +++ b/repo @@ -531,6 +531,8 @@ def _Init(args, gitc_init=False): else: do_verify = True + if not opt.quiet: + print('Downloading Repo source from', url) dst = os.path.abspath(os.path.join(repodir, S_repo)) _Clone(url, dst, opt.clone_bundle, opt.quiet, opt.verbose) @@ -752,9 +754,6 @@ def _InitHttp(): def _Fetch(url, cwd, src, quiet, verbose): - if not quiet: - print('Get %s' % url, file=sys.stderr) - cmd = ['fetch'] if quiet: cmd.append('--quiet') @@ -801,8 +800,8 @@ def _DownloadBundle(url, cwd, quiet, verbose): print('fatal: error %s' % e.reason, file=sys.stderr) raise CloneFailure() try: - if not quiet: - print('Get %s' % url, file=sys.stderr) + if verbose: + print('Downloading clone bundle %s' % url, file=sys.stderr) while True: buf = r.read(8192) if not buf: @@ -825,6 +824,9 @@ def _ImportBundle(cwd): def _Clone(url, cwd, clone_bundle, quiet, verbose): """Clones a git repository to a new subdirectory of repodir """ + if verbose: + print('Cloning git repository', url) + try: os.mkdir(cwd) except OSError as e: diff --git a/subcmds/init.py b/subcmds/init.py index be73cec..2003006 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -193,7 +193,8 @@ to update the working directory files. sys.exit(1) if not opt.quiet: - print('Get %s' % GitConfig.ForUser().UrlInsteadOf(opt.manifest_url), + print('Downloading manifest from %s' % + (GitConfig.ForUser().UrlInsteadOf(opt.manifest_url),), file=sys.stderr) # The manifest project object doesn't keep track of the path on the