summaryrefslogtreecommitdiff
path: root/git/compat.py
diff options
context:
space:
mode:
authorVincent Driessen <me@nvie.com>2016-04-19 21:35:39 +0200
committerVincent Driessen <me@nvie.com>2016-04-19 21:35:39 +0200
commit4adafc5a99947301ca0ce40511991d6d54c57a41 (patch)
treee7cf8a66b178baf8fa4fcfddc46f2134c48042ab /git/compat.py
parent76e19e4221684f24ef881415ec6ccb6bab6eb8e8 (diff)
parent3297fe50067da728eb6f3f47764efb223e0d6ea4 (diff)
downloadgitpython-4adafc5a99947301ca0ce40511991d6d54c57a41.tar.gz
Merge pull request #408 from nvie/master
Add support for diffing against root commit
Diffstat (limited to 'git/compat.py')
-rw-r--r--git/compat.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/git/compat.py b/git/compat.py
index 146bfd4b..7bd8e494 100644
--- a/git/compat.py
+++ b/git/compat.py
@@ -8,7 +8,6 @@
# flake8: noqa
import sys
-import six
from gitdb.utils.compat import (
PY3,
@@ -34,6 +33,7 @@ if PY3:
return bytes([n])
def mviter(d):
return d.values()
+ range = xrange
unicode = str
else:
FileType = file
@@ -44,21 +44,17 @@ else:
byte_ord = ord
bchr = chr
unicode = unicode
+ range = xrange
def mviter(d):
return d.itervalues()
-PRE_PY27 = sys.version_info < (2, 7)
-
def safe_decode(s):
"""Safely decodes a binary string to unicode"""
- if isinstance(s, six.text_type):
+ if isinstance(s, unicode):
return s
- elif isinstance(s, six.binary_type):
- if PRE_PY27:
- return s.decode(defenc) # we're screwed
- else:
- return s.decode(defenc, errors='replace')
+ elif isinstance(s, bytes):
+ return s.decode(defenc, errors='replace')
raise TypeError('Expected bytes or text, but got %r' % (s,))