From c3072c7f013c409662b6f41e99868d4dd3cc97f8 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 27 Apr 2019 14:10:47 -0700 Subject: [PATCH] filter-repo (python3): convert StringIO->BytesIO and __str__->__bytes__ Signed-off-by: Elijah Newren --- git-filter-repo | 4 ++-- t/t9391/unusual.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git-filter-repo b/git-filter-repo index 60ff51f..a76b90f 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -432,12 +432,12 @@ class _GitElement(object): raise SystemExit(_("Unimplemented function: %s") % type(self).__name__ +".dump()") # pragma: no cover - def __str__(self): + def __bytes__(self): """ Convert GitElement to string; used for debugging """ old_dumped = self.dumped - writeme = io.StringIO() + writeme = io.BytesIO() self.dump(writeme) output_lines = writeme.getvalue().splitlines() writeme.close() diff --git a/t/t9391/unusual.py b/t/t9391/unusual.py index 6817c65..c7a2c57 100755 --- a/t/t9391/unusual.py +++ b/t/t9391/unusual.py @@ -50,7 +50,7 @@ compare = "Blob:\n blob\n mark :1\n data {}\n {}".format(len(mystr), mystr) # debugging git-filter-repo; it is NOT something external folks should depend # upon. myblob = fr.Blob(mystr) -assert str(myblob) == compare +assert bytes(myblob) == compare # Everyone should be using RepoFilter objects, not FastExportFilter. But for # testing purposes... filter = fr.FastExportFilter('.', @@ -71,7 +71,7 @@ print("Found {} blobs/commits and {} other objects" .format(total_objects['common'], total_objects['uncommon'])) -stream = io.StringIO(textwrap.dedent(''' +stream = io.BytesIO(textwrap.dedent(''' blob mark :1 data 5