433
433
except errors.NoSuchRevisionInTree:
434
434
yield self.repository.revision_tree(revision_id)
437
def _file_revision(revision_tree, file_id):
438
"""Determine the revision associated with a file in a given tree."""
439
# FIXME: Shouldn't this be a RevisionTree method?
440
revision_tree.lock_read()
442
return revision_tree.inventory[file_id].revision
444
revision_tree.unlock()
446
436
def _get_file_revision(self, file_id, vf, tree_revision):
447
437
"""Ensure that file_id, tree_revision is in vf to plan the merge."""
449
439
if getattr(self, '_repository', None) is None:
450
440
last_revision = tree_revision
451
parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
441
parent_keys = [(file_id, t.get_file_revision(file_id)) for t in
452
442
self._iter_parent_trees()]
453
443
vf.add_lines((file_id, last_revision), parent_keys,
454
444
self.get_file_lines(file_id))
455
445
repo = self.branch.repository
456
446
base_vf = repo.texts
458
last_revision = self._file_revision(self, file_id)
448
last_revision = self.get_file_revision(file_id)
459
449
base_vf = self._repository.texts
460
450
if base_vf not in vf.fallback_versionedfiles:
461
451
vf.fallback_versionedfiles.append(base_vf)