1008
1008
nostore_sha=nostore_sha))[0]
1009
1009
return sha1, length, None
1011
def _add_text(self, key, parents, text, nostore_sha=None, random_id=False):
1012
"""See VersionedFiles.add_text()."""
1013
self._index._check_write_ok()
1014
self._check_add(key, None, random_id, check_content=False)
1015
if text.__class__ is not str:
1016
raise errors.BzrBadParameterUnicode("text")
1018
# The caller might pass None if there is no graph data, but kndx
1019
# indexes can't directly store that, so we give them
1020
# an empty tuple instead.
1022
# double handling for now. Make it work until then.
1024
record = FulltextContentFactory(key, parents, None, text)
1025
sha1 = list(self._insert_record_stream([record], random_id=random_id,
1026
nostore_sha=nostore_sha))[0]
1027
return sha1, length, None
1011
1029
def add_fallback_versioned_files(self, a_versioned_files):
1012
1030
"""Add a source of texts for texts not present in this knit.
1532
1548
'unordered', True)):
1533
1549
# XXX: todo - optimise to use less than full texts.
1534
1550
key = record.key
1535
pb.update('Walking content', key_idx, total)
1552
pb.update('Walking content', key_idx, total)
1536
1553
if record.storage_kind == 'absent':
1537
1554
raise errors.RevisionNotPresent(key, self)
1538
1555
lines = osutils.split_lines(record.get_bytes_as('fulltext'))
1539
1556
for line in lines:
1540
1557
yield line, key
1541
pb.update('Walking content', total, total)
1559
pb.update('Walking content', total, total)
1543
1561
def keys(self):
1544
1562
"""See VersionedFiles.keys."""
1668
1686
if check_present:
1669
1687
missing_keys = keys.difference(found_keys)
1670
1688
if missing_keys:
1671
raise RevisionNotPresent(missing_keys.pop(), self)
1689
raise errors.RevisionNotPresent(missing_keys.pop(), self)
1673
1691
def get_parent_map(self, keys):
1674
1692
"""Get a map of the parents of keys.