|
31 | 31 | TagReference
|
32 | 32 | )
|
33 | 33 | from git.objects.commit import Commit
|
| 34 | +from cStringIO import StringIO |
34 | 35 | import re
|
35 | 36 | import os
|
36 | 37 | import sys
|
@@ -305,9 +306,15 @@ def info(self, sha):
|
305 | 306 | return OInfo(hex_to_bin(hexsha), typename, size)
|
306 | 307 |
|
307 | 308 | def stream(self, sha):
|
308 |
| - """For now, all lookup is done by git itself""" |
309 |
| - hexsha, typename, size, stream = self._git.stream_object_data(bin_to_hex(sha)) |
310 |
| - return OStream(hex_to_bin(hexsha), typename, size, stream) |
| 309 | + """For now, all lookup is done by git itself |
| 310 | + :note: As we don't know when the stream is actually read (and if it is |
| 311 | + stored for later use) we read the data rigth away and cache it. |
| 312 | + This has HUGE performance implication, both for memory as for |
| 313 | + reading/deserializing objects, but we have no other choice in order |
| 314 | + to make the database behaviour consistent with other implementations !""" |
| 315 | + |
| 316 | + hexsha, typename, size, data = self._git.get_object_data(bin_to_hex(sha)) |
| 317 | + return OStream(hex_to_bin(hexsha), typename, size, StringIO(data)) |
311 | 318 |
|
312 | 319 | def partial_to_complete_sha_hex(self, partial_hexsha):
|
313 | 320 | """:return: Full binary 20 byte sha from the given partial hexsha
|
|
0 commit comments