Browse Source

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>
Mike Frysinger 6 năm trước cách đây
mục cha
commit
dcbfadf814
2 tập tin đã thay đổi với 9 bổ sung6 xóa
  1. 7 5
      repo
  2. 2 1
      subcmds/init.py

+ 7 - 5
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:

+ 2 - 1
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