79
79
self._transport.put(fn, sio)
81
def _do_copy(self, other, to_copy, pb, permit_failure=False):
82
if isinstance(other, CompressedTextStore):
83
return self._copy_multi_text(other, to_copy, pb,
84
permit_failure=permit_failure)
85
return super(CompressedTextStore, self)._do_copy(other, to_copy,
86
pb, permit_failure=permit_failure)
88
def _copy_multi_text(self, other, to_copy, pb,
89
permit_failure=False):
90
# Because of _transport, we can no longer assume
91
# that they are on the same filesystem, we can, however
92
# assume that we only need to copy the exact bytes,
93
# we don't need to process the files.
98
for fileid, has in zip(to_copy, other.has(to_copy)):
100
new_to_copy.add(fileid)
103
to_copy = new_to_copy
104
#mutter('_copy_multi_text copying %s, failed %s' % (to_copy, failed))
106
paths = [self._relpath(fileid) for fileid in to_copy]
107
count = other._transport.copy_to(paths, self._transport, pb=pb)
108
assert count == len(to_copy)
81
def _copy_one(self, fileid, other, pb):
82
if not (isinstance(other, CompressedTextStore)
83
and other._prefixed == self._prefixed):
84
return super(CompressedTextStore, self)._copy_one(fileid,
86
path = self._relpath(fileid)
87
assert other._transport.copy_to([path], self._transport, pb=pb) == 1
111
89
def __init__(self, transport, prefixed=False):
112
90
super(CompressedTextStore, self).__init__(transport, prefixed)