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 <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
Mike Frysinger 2020-02-22 00:04:39 -05:00 committed by David Pursehouse
parent edd3d45b35
commit dcbfadf814
2 changed files with 9 additions and 6 deletions

12
repo
View File

@ -531,6 +531,8 @@ def _Init(args, gitc_init=False):
else: else:
do_verify = True do_verify = True
if not opt.quiet:
print('Downloading Repo source from', url)
dst = os.path.abspath(os.path.join(repodir, S_repo)) dst = os.path.abspath(os.path.join(repodir, S_repo))
_Clone(url, dst, opt.clone_bundle, opt.quiet, opt.verbose) _Clone(url, dst, opt.clone_bundle, opt.quiet, opt.verbose)
@ -752,9 +754,6 @@ def _InitHttp():
def _Fetch(url, cwd, src, quiet, verbose): def _Fetch(url, cwd, src, quiet, verbose):
if not quiet:
print('Get %s' % url, file=sys.stderr)
cmd = ['fetch'] cmd = ['fetch']
if quiet: if quiet:
cmd.append('--quiet') cmd.append('--quiet')
@ -801,8 +800,8 @@ def _DownloadBundle(url, cwd, quiet, verbose):
print('fatal: error %s' % e.reason, file=sys.stderr) print('fatal: error %s' % e.reason, file=sys.stderr)
raise CloneFailure() raise CloneFailure()
try: try:
if not quiet: if verbose:
print('Get %s' % url, file=sys.stderr) print('Downloading clone bundle %s' % url, file=sys.stderr)
while True: while True:
buf = r.read(8192) buf = r.read(8192)
if not buf: if not buf:
@ -825,6 +824,9 @@ def _ImportBundle(cwd):
def _Clone(url, cwd, clone_bundle, quiet, verbose): def _Clone(url, cwd, clone_bundle, quiet, verbose):
"""Clones a git repository to a new subdirectory of repodir """Clones a git repository to a new subdirectory of repodir
""" """
if verbose:
print('Cloning git repository', url)
try: try:
os.mkdir(cwd) os.mkdir(cwd)
except OSError as e: except OSError as e:

View File

@ -193,7 +193,8 @@ to update the working directory files.
sys.exit(1) sys.exit(1)
if not opt.quiet: 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) file=sys.stderr)
# The manifest project object doesn't keep track of the path on the # The manifest project object doesn't keep track of the path on the