1085
1085
parent_lines, left_parent_blocks))
1088
def get_annotator(self):
1089
return annotate.Annotator(self)
1088
1091
missing_keys = index._missing_keys_from_parent_map
1090
1093
def _extract_blocks(self, version_id, source, target):
1159
1162
result.append((prefix + (origin,), line))
1162
def get_annotator(self):
1163
return annotate.Annotator(self)
1165
1165
def check(self, progress_bar=None, keys=None):
1166
1166
"""See VersionedFiles.check()."""
1167
1167
# XXX: This is over-enthusiastic but as we only thunk for Weaves today
1627
class NoDupeAddLinesDecorator(object):
1628
"""Decorator for a VersionedFiles that skips doing an add_lines if the key
1632
def __init__(self, store):
1635
def add_lines(self, key, parents, lines, parent_texts=None,
1636
left_matching_blocks=None, nostore_sha=None, random_id=False,
1637
check_content=True):
1638
"""See VersionedFiles.add_lines.
1640
This implementation may return None as the third element of the return
1641
value when the original store wouldn't.
1644
raise NotImplementedError(
1645
"NoDupeAddLinesDecorator.add_lines does not implement the "
1646
"nostore_sha behaviour.")
1648
sha1 = osutils.sha_strings(lines)
1649
key = ("sha1:" + sha1,)
1652
if key in self._store.get_parent_map([key]):
1653
# This key has already been inserted, so don't do it again.
1655
sha1 = osutils.sha_strings(lines)
1656
return sha1, sum(map(len, lines)), None
1657
return self._store.add_lines(key, parents, lines,
1658
parent_texts=parent_texts,
1659
left_matching_blocks=left_matching_blocks,
1660
nostore_sha=nostore_sha, random_id=random_id,
1661
check_content=check_content)
1663
def __getattr__(self, name):
1664
return getattr(self._store, name)
1627
1667
def network_bytes_to_kind_and_offset(network_bytes):
1628
1668
"""Strip of a record kind from the front of network_bytes.