diff mbox series

[13/13] git-p4: use python3's input() everywhere

Message ID 20191207003333.3228-16-yang.zhao@skyboxlabs.com (mailing list archive)
State New, archived
Headers show
Series git-p4: python3 compatibility | expand

Commit Message

Yang Zhao Dec. 7, 2019, 12:33 a.m. UTC
Python3 deprecates raw_input() from 2.7 and replaced it with input().
Since we do not need 2.7's input() semantics, `raw_input()` is aliased
to `input()` for easy forward compatability.

Signed-off-by: Yang Zhao <yang.zhao@skyboxlabs.com>
---
 git-p4.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/git-p4.py b/git-p4.py
index f975f197a5..97a9def657 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -33,6 +33,8 @@ 
 else:
     bytes = str
     basestring = basestring
+    # We want python3's input() semantics
+    input = raw_input
 
 try:
     from subprocess import CalledProcessError
@@ -1819,7 +1821,7 @@  def edit_template(self, template_file):
             return True
 
         while True:
-            response = raw_input("Submit template unchanged. Submit anyway? [y]es, [n]o (skip this patch) ")
+            response = input("Submit template unchanged. Submit anyway? [y]es, [n]o (skip this patch) ")
             if response == 'y':
                 return True
             if response == 'n':
@@ -2390,7 +2392,7 @@  def run(self, args):
                         # prompt for what to do, or use the option/variable
                         if self.conflict_behavior == "ask":
                             print("What do you want to do?")
-                            response = raw_input("[s]kip this commit but apply"
+                            response = input("[s]kip this commit but apply"
                                                  " the rest, or [q]uit? ")
                             if not response:
                                 continue