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 <bcasey@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Casey committed Jan 26, 2013 at 11:14 UTC 598354c0ad4198daff279c34a96f42e4d91fb4e6
2 files changed +3 -2
INSTALL
+1 -1
@@ -131,7 +131,7 @@ Issues of note:
131 use English. Under autoconf the configure script will do this
132 automatically if it can't find libintl on the system.
133
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
135 interface to Perforce.
136
137 - Some platform specific issues are dealt with Makefile rules,
git-p4.py
+2 -1
@@ -742,7 +742,8 @@ def wildcard_encode(path):
742 return path
743
744 def wildcard_present(path):
745 - return path.translate(None, "*#@%") != path
745 + m = re.search("[*#@%]", path)
746 + return m is not None
747
748 class Command:
749 def __init__(self):