628
628
assert r.revision_id == revision_id
631
def get_revisions(self, revision_ids. pb=None):
632
"""Return the Revision object for a set of named revisions"""
633
from bzrlib.revision import Revision
634
from bzrlib.xml import unpack_xml
638
for f in self.revision_store.get(revision_ids, pb=pb):
639
yield unpack_xml(Revision, f)
632
644
def get_revision_sha1(self, revision_id):
633
645
"""Hash the stored value of a revision, and return it."""
649
661
from bzrlib.inventory import Inventory
650
662
from bzrlib.xml import unpack_xml
652
return unpack_xml(Inventory, self.inventory_store[inventory_id])
666
return unpack_xml(Inventory, self.inventory_store[inventory_id])
670
def get_inventories(self, inventory_ids, pb=None):
671
"""Get Inventory objects by id
673
from bzrlib.inventory import Inventory
674
from bzrlib.xml import unpack_xml
678
for f in self.inventory_store.get(inventory_ids, pb=pb):
679
yield unpack_xml(Inventory, f)
655
684
def get_inventory_sha1(self, inventory_id):
849
878
if hasattr(other.revision_store, "prefetch"):
850
879
other.revision_store.prefetch(revision_ids)
851
880
if hasattr(other.inventory_store, "prefetch"):
852
inventory_ids = [other.get_revision(r).inventory_id
853
for r in revision_ids]
854
other.inventory_store.prefetch(inventory_ids)
881
other.inventory_store.prefetch(revision_ids)
883
revisions = self.get_revisions(revision_ids, pb=pb)
884
inventories = self.get_inventories(revision_ids, pb=pb)
857
885
needed_texts = set()
859
for rev_id in revision_ids:
888
for rev, inv in zip(revisions, inventories):
861
890
pb.update('fetching revision', i, len(revision_ids))
862
rev = other.get_revision(rev_id)
863
revisions.append(rev)
864
inv = other.get_inventory(str(rev.inventory_id))
865
892
for key, entry in inv.iter_entries():
866
893
if entry.text_id is None:
868
if entry.text_id not in self.text_store:
869
needed_texts.add(entry.text_id)
895
text_ids.append(entry.text_id)
896
has_ids = self.text_store.has(text_ids)
897
for has, text_id in zip(has_ids, text_ids):
899
needed_texts.add(text_id)