Skip to content

Commit

Permalink
git-p4.py: support Python 2.5
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Jan 27, 2013
1 parent 5d41784 commit 598354c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Issues of note:
use English. Under autoconf the configure script will do this
automatically if it can't find libintl on the system.

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

- Some platform specific issues are dealt with Makefile rules,
Expand Down
3 changes: 2 additions & 1 deletion git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ def wildcard_encode(path):
return path

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

class Command:
def __init__(self):
Expand Down

0 comments on commit 598354c

Please sign in to comment.