738
764
paths = list(relpaths)
739
765
return set([self._mapper.unmap(path) for path in paths])
741
_legacy_formats = [RepositoryFormat4(),
768
class InterWeaveRepo(InterSameDataRepository):
769
"""Optimised code paths between Weave based repositories.
773
def _get_repo_format_to_test(self):
774
return RepositoryFormat7()
777
def is_compatible(source, target):
778
"""Be compatible with known Weave formats.
780
We don't test for the stores being of specific types because that
781
could lead to confusing results, and there is no need to be
785
return (isinstance(source._format, (RepositoryFormat5,
787
RepositoryFormat7)) and
788
isinstance(target._format, (RepositoryFormat5,
791
except AttributeError:
795
def copy_content(self, revision_id=None):
796
"""See InterRepository.copy_content()."""
797
# weave specific optimised path:
799
self.target.set_make_working_trees(self.source.make_working_trees())
800
except (errors.RepositoryUpgradeRequired, NotImplemented):
803
if self.source._transport.listable():
804
pb = ui.ui_factory.nested_progress_bar()
806
self.target.texts.insert_record_stream(
807
self.source.texts.get_record_stream(
808
self.source.texts.keys(), 'topological', False))
809
pb.update('Copying inventory', 0, 1)
810
self.target.inventories.insert_record_stream(
811
self.source.inventories.get_record_stream(
812
self.source.inventories.keys(), 'topological', False))
813
self.target.signatures.insert_record_stream(
814
self.source.signatures.get_record_stream(
815
self.source.signatures.keys(),
817
self.target.revisions.insert_record_stream(
818
self.source.revisions.get_record_stream(
819
self.source.revisions.keys(),
820
'topological', True))
824
self.target.fetch(self.source, revision_id=revision_id)
827
def search_missing_revision_ids(self,
828
revision_id=symbol_versioning.DEPRECATED_PARAMETER,
829
find_ghosts=True, revision_ids=None, if_present_ids=None):
830
"""See InterRepository.search_missing_revision_ids()."""
831
# we want all revisions to satisfy revision_id in source.
832
# but we don't want to stat every file here and there.
833
# we want then, all revisions other needs to satisfy revision_id
834
# checked, but not those that we have locally.
835
# so the first thing is to get a subset of the revisions to
836
# satisfy revision_id in source, and then eliminate those that
837
# we do already have.
838
# this is slow on high latency connection to self, but as this
839
# disk format scales terribly for push anyway due to rewriting
840
# inventory.weave, this is considered acceptable.
842
if symbol_versioning.deprecated_passed(revision_id):
843
symbol_versioning.warn(
844
'search_missing_revision_ids(revision_id=...) was '
845
'deprecated in 2.4. Use revision_ids=[...] instead.',
846
DeprecationWarning, stacklevel=2)
847
if revision_ids is not None:
848
raise AssertionError(
849
'revision_ids is mutually exclusive with revision_id')
850
if revision_id is not None:
851
revision_ids = [revision_id]
853
source_ids_set = self._present_source_revisions_for(
854
revision_ids, if_present_ids)
855
# source_ids is the worst possible case we may need to pull.
856
# now we want to filter source_ids against what we actually
857
# have in target, but don't try to check for existence where we know
858
# we do not have a revision as that would be pointless.
859
target_ids = set(self.target._all_possible_ids())
860
possibly_present_revisions = target_ids.intersection(source_ids_set)
861
actually_present_revisions = set(
862
self.target._eliminate_revisions_not_present(possibly_present_revisions))
863
required_revisions = source_ids_set.difference(actually_present_revisions)
864
if revision_ids is not None:
865
# we used get_ancestry to determine source_ids then we are assured all
866
# revisions referenced are present as they are installed in topological order.
867
# and the tip revision was validated by get_ancestry.
868
result_set = required_revisions
870
# if we just grabbed the possibly available ids, then
871
# we only have an estimate of whats available and need to validate
872
# that against the revision records.
874
self.source._eliminate_revisions_not_present(required_revisions))
875
return self.source.revision_ids_to_search_result(result_set)
878
InterRepository.register_optimiser(InterWeaveRepo)
881
def get_extra_interrepo_test_combinations():
882
from bzrlib.repofmt import knitrepo
883
return [(InterRepository, RepositoryFormat5(),
884
knitrepo.RepositoryFormatKnit3())]