278
278
raise NotImplementedError(self.get_symlink_target)
280
def get_root_id(self):
281
"""Return the file_id for the root of this tree."""
282
raise NotImplementedError(self.get_root_id)
280
284
def annotate_iter(self, file_id):
281
285
"""Return an iterator of revision_id, line tuples.
295
299
uncommitted changes in the other tree, they will be assigned to the
296
300
'other:' pseudo-revision.
298
from bzrlib import merge
299
annotated_a = list(self.annotate_iter(file_id,
300
_mod_revision.CURRENT_REVISION))
301
annotated_b = list(other.annotate_iter(file_id, 'other:'))
302
ancestors_a = self._get_ancestors(_mod_revision.CURRENT_REVISION)
303
ancestors_b = other._get_ancestors('other:')
304
return merge._plan_annotate_merge(annotated_a, annotated_b,
305
ancestors_a, ancestors_b)
302
from bzrlib import merge, versionedfile
303
vf = versionedfile._PlanMergeVersionedFile(file_id)
304
last_revision_a = self._get_file_revision(file_id, vf, 'this:')
305
last_revision_b = other._get_file_revision(file_id, vf, 'other:')
306
return vf.plan_merge(last_revision_a, last_revision_b)
308
def _get_file_revision(self, file_id, vf, tree_revision):
309
def file_revision(revision_tree):
310
revision_tree.lock_read()
312
return revision_tree.inventory[file_id].revision
314
revision_tree.unlock()
316
def iter_parent_trees():
317
for revision_id in self.get_parent_ids():
319
yield self.revision_tree(revision_id)
321
yield self.repository.revision_tree(revision_id)
323
if getattr(self, '_get_weave', None) is None:
324
last_revision = tree_revision
325
parent_revisions = [file_revision(t) for t in iter_parent_trees()]
326
vf.add_lines(last_revision, parent_revisions,
327
self.get_file(file_id).readlines())
328
repo = self.branch.repository
329
transaction = repo.get_transaction()
330
base_vf = repo.weave_store.get_weave(file_id, transaction)
332
last_revision = file_revision(self)
333
base_vf = self._get_weave(file_id)
334
vf.fallback_versionedfiles.append(base_vf)
307
337
inventory = property(_get_inventory,
308
338
doc="Inventory of this Tree")