Skip to content

Commit 598354c

Browse files
drafnelgitster
authored andcommitted
git-p4.py: support Python 2.5
Python 2.5 and older do not accept None as the first argument to translate() and complain with: TypeError: expected a character buffer object As suggested by Pete Wyckoff, let's just replace the call to translate() with a regex search which should be more clear and more portable. This allows git-p4 to be used with Python 2.5. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5d41784 commit 598354c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Issues of note:
131131
use English. Under autoconf the configure script will do this
132132
automatically if it can't find libintl on the system.
133133

134-
- Python version 2.6 or later is needed to use the git-p4
134+
- Python version 2.5 or later is needed to use the git-p4
135135
interface to Perforce.
136136

137137
- Some platform specific issues are dealt with Makefile rules,

git-p4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ def wildcard_encode(path):
742742
return path
743743

744744
def wildcard_present(path):
745-
return path.translate(None, "*#@%") != path
745+
m = re.search("[*#@%]", path)
746+
return m is not None
746747

747748
class Command:
748749
def __init__(self):

0 commit comments

Comments
 (0)