From f6aa8d116eb33293c0a9d6d600eb7c32832758b9 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 4 Jan 2015 19:14:33 +0100 Subject: initial set of adjustments to make (most) imports work. More to come, especially when it's about strings --- git/diff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git/diff.py') diff --git a/git/diff.py b/git/diff.py index 5325ad6b..b3e7245b 100644 --- a/git/diff.py +++ b/git/diff.py @@ -3,13 +3,13 @@ # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php - import re -from objects.blob import Blob -from objects.util import mode_str_to_int from gitdb.util import hex_to_bin +from .objects.blob import Blob +from .objects.util import mode_str_to_int + __all__ = ('Diffable', 'DiffIndex', 'Diff') -- cgit v1.2.1 From e1060a2a8c90c0730c3541811df8f906dac510a7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 5 Jan 2015 17:59:22 +0100 Subject: test_commit works once again --- git/diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/diff.py') diff --git a/git/diff.py b/git/diff.py index b3e7245b..1692d83e 100644 --- a/git/diff.py +++ b/git/diff.py @@ -195,7 +195,7 @@ class Diff(object): """, re.VERBOSE | re.MULTILINE) # can be used for comparisons NULL_HEX_SHA = "0" * 40 - NULL_BIN_SHA = "\0" * 20 + NULL_BIN_SHA = b"\0" * 20 __slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file", "rename_from", "rename_to", "diff") -- cgit v1.2.1 From 31b3673bdb9d8fb7feea8ae887be455c4a880f76 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 5 Jan 2015 18:03:08 +0100 Subject: test_diff works --- git/diff.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git/diff.py') diff --git a/git/diff.py b/git/diff.py index 1692d83e..3c4e8529 100644 --- a/git/diff.py +++ b/git/diff.py @@ -10,6 +10,8 @@ from gitdb.util import hex_to_bin from .objects.blob import Blob from .objects.util import mode_str_to_int +from git.compat import defenc + __all__ = ('Diffable', 'DiffIndex', 'Diff') @@ -294,7 +296,7 @@ class Diff(object): :param stream: result of 'git diff' as a stream (supporting file protocol) :return: git.DiffIndex """ # for now, we have to bake the stream - text = stream.read() + text = stream.read().decode(defenc) index = DiffIndex() diff_header = cls.re_header.match @@ -323,6 +325,7 @@ class Diff(object): # :100644 100644 687099101... 37c5e30c8... M .gitignore index = DiffIndex() for line in stream: + line = line.decode(defenc) if not line.startswith(":"): continue # END its not a valid diff line -- cgit v1.2.1