summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorYang Zhao <yang.zhao@skyboxlabs.com>2019-12-13 15:52:47 -0800
committerJunio C Hamano <gitster@pobox.com>2020-01-15 12:53:40 -0800
commit7575f4fdecf22cf232975625ec53add3f2b962e4 (patch)
tree164fd8e085a6123164ce81690f4c2c83d698d5f4 /git-p4.py
parentce425eb4e16e5038ffc322cbafc80d641b0ad5eb (diff)
downloadgit-7575f4fdecf22cf232975625ec53add3f2b962e4.tar.gz
git-p4: use python3's input() everywhere
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/git-p4.py b/git-p4.py
index 3af8df9f83..17f72f4309 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -27,6 +27,16 @@ import zlib
import ctypes
import errno
+# On python2.7 where raw_input() and input() are both availble,
+# we want raw_input's semantics, but aliased to input for python3
+# compatibility
+# support basestring in python3
+try:
+ if raw_input and input:
+ input = raw_input
+except:
+ pass
+
verbose = False
# Only labels/tags matching this will be imported/exported
@@ -1801,7 +1811,7 @@ class P4Submit(Command, P4UserMap):
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':
@@ -2372,7 +2382,7 @@ class P4Submit(Command, P4UserMap):
# 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