mirror of
https://github.com/git/git.git
synced 2024-05-21 10:26:08 +02:00
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>
This commit is contained in:
parent
ce425eb4e1
commit
7575f4fdec
14
git-p4.py
14
git-p4.py
|
@ -27,6 +27,16 @@
|
||||||
import ctypes
|
import ctypes
|
||||||
import errno
|
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
|
verbose = False
|
||||||
|
|
||||||
# Only labels/tags matching this will be imported/exported
|
# Only labels/tags matching this will be imported/exported
|
||||||
|
@ -1801,7 +1811,7 @@ def edit_template(self, template_file):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
while 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':
|
if response == 'y':
|
||||||
return True
|
return True
|
||||||
if response == 'n':
|
if response == 'n':
|
||||||
|
@ -2372,7 +2382,7 @@ def run(self, args):
|
||||||
# prompt for what to do, or use the option/variable
|
# prompt for what to do, or use the option/variable
|
||||||
if self.conflict_behavior == "ask":
|
if self.conflict_behavior == "ask":
|
||||||
print("What do you want to do?")
|
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? ")
|
" the rest, or [q]uit? ")
|
||||||
if not response:
|
if not response:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue