mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo (python3): convert StringIO->BytesIO and __str__->__bytes__
Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
0279e3882d
commit
c3072c7f01
@ -432,12 +432,12 @@ class _GitElement(object):
|
|||||||
raise SystemExit(_("Unimplemented function: %s") % type(self).__name__
|
raise SystemExit(_("Unimplemented function: %s") % type(self).__name__
|
||||||
+".dump()") # pragma: no cover
|
+".dump()") # pragma: no cover
|
||||||
|
|
||||||
def __str__(self):
|
def __bytes__(self):
|
||||||
"""
|
"""
|
||||||
Convert GitElement to string; used for debugging
|
Convert GitElement to string; used for debugging
|
||||||
"""
|
"""
|
||||||
old_dumped = self.dumped
|
old_dumped = self.dumped
|
||||||
writeme = io.StringIO()
|
writeme = io.BytesIO()
|
||||||
self.dump(writeme)
|
self.dump(writeme)
|
||||||
output_lines = writeme.getvalue().splitlines()
|
output_lines = writeme.getvalue().splitlines()
|
||||||
writeme.close()
|
writeme.close()
|
||||||
|
@ -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
|
# debugging git-filter-repo; it is NOT something external folks should depend
|
||||||
# upon.
|
# upon.
|
||||||
myblob = fr.Blob(mystr)
|
myblob = fr.Blob(mystr)
|
||||||
assert str(myblob) == compare
|
assert bytes(myblob) == compare
|
||||||
# Everyone should be using RepoFilter objects, not FastExportFilter. But for
|
# Everyone should be using RepoFilter objects, not FastExportFilter. But for
|
||||||
# testing purposes...
|
# testing purposes...
|
||||||
filter = fr.FastExportFilter('.',
|
filter = fr.FastExportFilter('.',
|
||||||
@ -71,7 +71,7 @@ print("Found {} blobs/commits and {} other objects"
|
|||||||
.format(total_objects['common'], total_objects['uncommon']))
|
.format(total_objects['common'], total_objects['uncommon']))
|
||||||
|
|
||||||
|
|
||||||
stream = io.StringIO(textwrap.dedent('''
|
stream = io.BytesIO(textwrap.dedent('''
|
||||||
blob
|
blob
|
||||||
mark :1
|
mark :1
|
||||||
data 5
|
data 5
|
||||||
|
Loading…
Reference in New Issue
Block a user