1320
1320
PlanWeaveMerge.__init__(self, plan, a_marker, b_marker)
1323
class VirtualVersionedFiles(VersionedFiles):
1324
"""Dummy implementation for VersionedFiles that uses other functions for
1325
obtaining fulltexts and parent maps.
1327
This is always on the bottom of the stack and uses string keys
1328
(rather than tuples) internally.
1331
def __init__(self, get_parent_map, get_lines):
1332
"""Create a VirtualVersionedFiles.
1334
:param get_parent_map: Same signature as Repository.get_parent_map.
1335
:param get_lines: Should return lines for specified key or None if
1338
super(VirtualVersionedFiles, self).__init__()
1339
self._get_parent_map = get_parent_map
1340
self._get_lines = get_lines
1342
def check(self, progressbar=None):
1343
"""See VersionedFiles.check.
1345
:note: Always returns True for VirtualVersionedFiles.
1349
def add_mpdiffs(self, records):
1350
"""See VersionedFiles.mpdiffs.
1352
:note: Not implemented for VirtualVersionedFiles.
1354
raise NotImplementedError(self.add_mpdiffs)
1356
def get_parent_map(self, keys):
1357
"""See VersionedFiles.get_parent_map."""
1358
return dict([((k,), tuple([(p,) for p in v])) for k,v in self._get_parent_map([k for (k,) in keys]).iteritems()])
1360
def get_sha1s(self, keys):
1361
"""See VersionedFiles.get_sha1s."""
1364
lines = self._get_lines(k)
1365
if lines is not None:
1366
assert isinstance(lines, list)
1367
ret[(k,)] = osutils.sha_strings(lines)
1370
def get_record_stream(self, keys, ordering, include_delta_closure):
1371
"""See VersionedFiles.get_record_stream."""
1372
for (k,) in list(keys):
1373
lines = self._get_lines(k)
1374
if lines is not None:
1375
assert isinstance(lines, list)
1376
yield FulltextContentFactory((k,), None,
1377
sha1=osutils.sha_strings(lines),
1378
text=''.join(lines))
1380
yield AbsentContentFactory((k,))