mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
project: fix error display when output_redir is disabled
We always pass in output_redir when syncing, but that's the common case: there are a few situations (like `repo init`) where we don't pass in a buffer, and if any errors show up in that case, we'd crash. Rely on the print function to handle this logic for us. Bug: https://crbug.com/gerrit/14568 Change-Id: I8cd47e82329797ffc42534418a3dfbd8429205be Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/307222 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
993af5e136
commit
b16b9d26bd
@ -2197,7 +2197,7 @@ class Project(object):
|
|||||||
ret = prunecmd.Wait()
|
ret = prunecmd.Wait()
|
||||||
if ret:
|
if ret:
|
||||||
break
|
break
|
||||||
output_redir.write('retrying fetch after pruning remote branches')
|
print('retrying fetch after pruning remote branches', file=output_redir)
|
||||||
# Continue right away so we don't sleep as we shouldn't need to.
|
# Continue right away so we don't sleep as we shouldn't need to.
|
||||||
continue
|
continue
|
||||||
elif current_branch_only and is_sha1 and ret == 128:
|
elif current_branch_only and is_sha1 and ret == 128:
|
||||||
@ -2210,10 +2210,11 @@ class Project(object):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# Figure out how long to sleep before the next attempt, if there is one.
|
# Figure out how long to sleep before the next attempt, if there is one.
|
||||||
if not verbose:
|
if not verbose and gitcmd.stdout:
|
||||||
output_redir.write('\n%s:\n%s' % (self.name, gitcmd.stdout))
|
print('\n%s:\n%s' % (self.name, gitcmd.stdout), end='', file=output_redir)
|
||||||
if try_n < retry_fetches - 1:
|
if try_n < retry_fetches - 1:
|
||||||
output_redir.write('sleeping %s seconds before retrying' % retry_cur_sleep)
|
print('%s: sleeping %s seconds before retrying' % (self.name, retry_cur_sleep),
|
||||||
|
file=output_redir)
|
||||||
time.sleep(retry_cur_sleep)
|
time.sleep(retry_cur_sleep)
|
||||||
retry_cur_sleep = min(retry_exp_factor * retry_cur_sleep,
|
retry_cur_sleep = min(retry_exp_factor * retry_cur_sleep,
|
||||||
MAXIMUM_RETRY_SLEEP_SEC)
|
MAXIMUM_RETRY_SLEEP_SEC)
|
||||||
|
Loading…
Reference in New Issue
Block a user