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