768
769
def versions(self):
769
770
"""See VersionedFile.versions."""
771
if 'evil' in debug.debug_flags:
772
trace.mutter_callsite(2, "versions scales with size of history")
770
773
return self._index.get_versions()
772
775
def has_version(self, version_id):
773
776
"""See VersionedFile.has_version."""
777
if 'evil' in debug.debug_flags:
778
trace.mutter_callsite(2, "has_version is a LBYL scenario")
774
779
version_id = osutils.safe_revision_id(version_id)
775
780
return self._index.has_version(version_id)
1164
1169
versions = [osutils.safe_revision_id(v) for v in versions]
1165
1170
return self._index.get_ancestry_with_ghosts(versions)
1167
#@deprecated_method(zero_eight)
1168
def walk(self, version_ids):
1169
"""See VersionedFile.walk."""
1170
# We take the short path here, and extract all relevant texts
1171
# and put them in a weave and let that do all the work. Far
1172
# from optimal, but is much simpler.
1173
# FIXME RB 20060228 this really is inefficient!
1174
from bzrlib.weave import Weave
1176
w = Weave(self.filename)
1177
ancestry = set(self.get_ancestry(version_ids, topo_sorted=False))
1178
sorted_graph = topo_sort(self._index.get_graph())
1179
version_list = [vid for vid in sorted_graph if vid in ancestry]
1181
for version_id in version_list:
1182
lines = self.get_lines(version_id)
1183
w.add_lines(version_id, self.get_parents(version_id), lines)
1185
for lineno, insert_id, dset, line in w.walk(version_ids):
1186
yield lineno, insert_id, dset, line
1188
1172
def plan_merge(self, ver_a, ver_b):
1189
1173
"""See VersionedFile.plan_merge."""
1190
1174
ver_a = osutils.safe_revision_id(ver_a)