sync.py: report the remote URL on fatal git remote errors

repo can be configured to download from any number of remote git repos.
However when one fails repo doesn't report which one. Example:
Fatal: remote error: Daily ls-remote rate limit exceeded for IP xx.xx.xx.xx

TEST=repo init -q -u https://chromium.googlesource.com/chromiumos/manifest.git
  # Apply patch in ./.repo/repo/
  # Simulate a git remote error:
  sed -i -e 's#chromiumos/docs#chromiumos/XXdocs#' .repo/manifests/full.xml
  repo sync --quiet --force-sync docs
  # error message now shows the remote URL

Optional test tip: reduce the time.sleep(random(...)) in ./.repo/repo/project.py

Change-Id: I4509383b6a43a8e66064778e8ed612d8a735c8b6
This commit is contained in:
Marc Herbert 2017-04-04 22:03:53 -07:00
parent 04071c1c72
commit ffb4b89099

View File

@ -324,7 +324,9 @@ later is required to fix a server side protocol bug.
if not success: if not success:
err_event.set() err_event.set()
print('error: Cannot fetch %s' % project.name, file=sys.stderr) print('error: Cannot fetch %s from %s'
% (project.name, project.remote.url),
file=sys.stderr)
if opt.force_broken: if opt.force_broken:
print('warn: --force-broken, continuing to sync', print('warn: --force-broken, continuing to sync',
file=sys.stderr) file=sys.stderr)