depot_tools: Use gclient_utils.AskForData instead of raw_input.
gclient_utils.AskForData will use raw_input on Python 2 and input on Python 3.
Bug: 1063976
Change-Id: I93c059c4e4454d01787716b5a0a2641ad5253f53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116370
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/git_drover.py b/git_drover.py
index 36d7a7c..a865181 100755
--- a/git_drover.py
+++ b/git_drover.py
@@ -17,6 +17,7 @@
import tempfile
import git_common
+import gclient_utils
if sys.version_info.major == 2:
import cPickle
@@ -70,12 +71,6 @@
mk_symlink = os.symlink
-def _raw_input(message):
- # Use this so that it can be mocked in tests on Python 2 and 3.
- if sys.version_info.major == 2:
- return raw_input(message)
- return input(message)
-
class _Drover(object):
def __init__(self, branch, revision, parent_repo, dry_run, verbose):
@@ -192,7 +187,7 @@
result = ''
while result not in ('y', 'n'):
try:
- result = _raw_input('%s Continue (y/n)? ' % message)
+ result = gclient_utils.AskForData('%s Continue (y/n)? ' % message)
except EOFError:
result = 'n'
return result == 'y'