mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Use print with flush=True instead of stdout.flush
Resolves multiple TODOs. Since we are requiring Python 3, we move to using print function with flush=True instead of using sys.stdout.flush(). Change-Id: I54db0344ec78ac81a8d6c6c7e43ee7d301f42f02 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354701 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
035f22abec
commit
e641281d14
@ -134,9 +134,7 @@ to update the working directory files.
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _Prompt(self, prompt, value):
|
def _Prompt(self, prompt, value):
|
||||||
print('%-10s [%s]: ' % (prompt, value), end='')
|
print('%-10s [%s]: ' % (prompt, value), end='', flush=True)
|
||||||
# TODO: When we require Python 3, use flush=True w/print above.
|
|
||||||
sys.stdout.flush()
|
|
||||||
a = sys.stdin.readline().strip()
|
a = sys.stdin.readline().strip()
|
||||||
if a == '':
|
if a == '':
|
||||||
return value
|
return value
|
||||||
@ -173,9 +171,7 @@ to update the working directory files.
|
|||||||
if not opt.quiet:
|
if not opt.quiet:
|
||||||
print()
|
print()
|
||||||
print('Your identity is: %s <%s>' % (name, email))
|
print('Your identity is: %s <%s>' % (name, email))
|
||||||
print('is this correct [y/N]? ', end='')
|
print('is this correct [y/N]? ', end='', flush=True)
|
||||||
# TODO: When we require Python 3, use flush=True w/print above.
|
|
||||||
sys.stdout.flush()
|
|
||||||
a = sys.stdin.readline().strip().lower()
|
a = sys.stdin.readline().strip().lower()
|
||||||
if a in ('yes', 'y', 't', 'true'):
|
if a in ('yes', 'y', 't', 'true'):
|
||||||
break
|
break
|
||||||
@ -217,9 +213,7 @@ to update the working directory files.
|
|||||||
out.printer(fg='black', attr=c)(' %-6s ', c)
|
out.printer(fg='black', attr=c)(' %-6s ', c)
|
||||||
out.nl()
|
out.nl()
|
||||||
|
|
||||||
print('Enable color display in this user account (y/N)? ', end='')
|
print('Enable color display in this user account (y/N)? ', end='', flush=True)
|
||||||
# TODO: When we require Python 3, use flush=True w/print above.
|
|
||||||
sys.stdout.flush()
|
|
||||||
a = sys.stdin.readline().strip().lower()
|
a = sys.stdin.readline().strip().lower()
|
||||||
if a in ('y', 'yes', 't', 'true', 'on'):
|
if a in ('y', 'yes', 't', 'true', 'on'):
|
||||||
gc.SetString('color.ui', 'auto')
|
gc.SetString('color.ui', 'auto')
|
||||||
|
@ -293,9 +293,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/
|
|||||||
for commit in commit_list:
|
for commit in commit_list:
|
||||||
print(' %s' % commit)
|
print(' %s' % commit)
|
||||||
|
|
||||||
print('to %s (y/N)? ' % remote.review, end='')
|
print('to %s (y/N)? ' % remote.review, end='', flush=True)
|
||||||
# TODO: When we require Python 3, use flush=True w/print above.
|
|
||||||
sys.stdout.flush()
|
|
||||||
if opt.yes:
|
if opt.yes:
|
||||||
print('<--yes>')
|
print('<--yes>')
|
||||||
answer = True
|
answer = True
|
||||||
@ -437,9 +435,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/
|
|||||||
print('Uncommitted changes in %s (did you forget to amend?):'
|
print('Uncommitted changes in %s (did you forget to amend?):'
|
||||||
% branch.project.name)
|
% branch.project.name)
|
||||||
print('\n'.join(changes))
|
print('\n'.join(changes))
|
||||||
print('Continue uploading? (y/N) ', end='')
|
print('Continue uploading? (y/N) ', end='', flush=True)
|
||||||
# TODO: When we require Python 3, use flush=True w/print above.
|
|
||||||
sys.stdout.flush()
|
|
||||||
if opt.yes:
|
if opt.yes:
|
||||||
print('<--yes>')
|
print('<--yes>')
|
||||||
a = 'yes'
|
a = 'yes'
|
||||||
|
Loading…
Reference in New Issue
Block a user