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