diff options
Diffstat (limited to 'git/objects')
-rw-r--r-- | git/objects/commit.py | 7 | ||||
-rw-r--r-- | git/objects/fun.py | 6 | ||||
-rw-r--r-- | git/objects/submodule/base.py | 3 | ||||
-rw-r--r-- | git/objects/tree.py | 3 |
4 files changed, 13 insertions, 6 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index 5b6b9a33..c9d7ddc8 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -23,6 +23,7 @@ from .util import ( altz_to_utctz_str, parse_actor_and_date ) +from git.compat import text_type from time import ( time, @@ -378,7 +379,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): a = self.author aname = a.name - if isinstance(aname, unicode): + if isinstance(aname, text_type): aname = aname.encode(self.encoding) # END handle unicode in name @@ -390,7 +391,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): # encode committer aname = c.name - if isinstance(aname, unicode): + if isinstance(aname, text_type): aname = aname.encode(self.encoding) # END handle unicode in name write(fmt % ("committer", aname, c.email, @@ -408,7 +409,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): write("\n") # write plain bytes, be sure its encoded according to our encoding - if isinstance(self.message, unicode): + if isinstance(self.message, text_type): write(self.message.encode(self.encoding)) else: write(self.message) diff --git a/git/objects/fun.py b/git/objects/fun.py index 416a52e6..db2ec7c2 100644 --- a/git/objects/fun.py +++ b/git/objects/fun.py @@ -1,5 +1,9 @@ """Module with functions which are supposed to be as fast as possible""" from stat import S_ISDIR +from git.compat import ( + xrange, + text_type +) __all__ = ('tree_to_stream', 'tree_entries_from_data', 'traverse_trees_recursive', 'traverse_tree_recursive') @@ -28,7 +32,7 @@ def tree_to_stream(entries, write): # hence we must convert to an utf8 string for it to work properly. # According to my tests, this is exactly what git does, that is it just # takes the input literally, which appears to be utf8 on linux. - if isinstance(name, unicode): + if isinstance(name, text_type): name = name.encode("utf8") write("%s %s\0%s" % (mode_str, name, binsha)) # END for each item diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 5ccebd4c..69bf748a 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -22,6 +22,7 @@ from git.exc import ( InvalidGitRepositoryError, NoSuchPathError ) +from git.compat import string_types import stat import git @@ -93,7 +94,7 @@ class Submodule(util.IndexObject, Iterable, Traversable): if url is not None: self._url = url if branch_path is not None: - assert isinstance(branch_path, basestring) + assert isinstance(branch_path, string_types) self._branch_path = branch_path if name is not None: self._name = name diff --git a/git/objects/tree.py b/git/objects/tree.py index a216322b..6776a15e 100644 --- a/git/objects/tree.py +++ b/git/objects/tree.py @@ -11,6 +11,7 @@ from . import util from .base import IndexObject from .blob import Blob from .submodule.base import Submodule +from git.compat import string_types from .fun import ( tree_entries_from_data, @@ -232,7 +233,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable): info = self._cache[item] return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join_path(self.path, info[2])) - if isinstance(item, basestring): + if isinstance(item, string_types): # compatability return self.__div__(item) # END index is basestring |