619
def install_revision(repository, rev, revision_tree):
620
"""Install all revision data into a repository."""
623
for p_id in rev.parent_ids:
624
if repository.has_revision(p_id):
625
present_parents.append(p_id)
626
parent_trees[p_id] = repository.revision_tree(p_id)
628
parent_trees[p_id] = EmptyTree()
630
inv = revision_tree.inventory
632
# Add the texts that are not already present
633
for path, ie in inv.iter_entries():
634
w = repository.weave_store.get_weave_or_empty(ie.file_id,
635
repository.get_transaction())
636
if ie.revision not in w:
638
for revision, tree in parent_trees.iteritems():
639
if ie.file_id not in tree:
641
parent_id = tree.inventory[ie.file_id].revision
642
if parent_id in text_parents:
644
text_parents.append(parent_id)
646
vfile = repository.weave_store.get_weave_or_empty(ie.file_id,
647
repository.get_transaction())
648
lines = revision_tree.get_file(ie.file_id).readlines()
649
vfile.add_lines(rev.revision_id, text_parents, lines)
651
# install the inventory
652
repository.add_inventory(rev.revision_id, inv, present_parents)
653
except errors.RevisionAlreadyPresent:
655
repository.add_revision(rev.revision_id, rev, inv)
619
658
class MetaDirRepository(Repository):
620
659
"""Repositories in the new meta-dir layout."""