510
512
def get_format_description(self):
511
513
"""See RepositoryFormat.get_format_description()."""
512
514
return "Knit repository format 4"
517
class InterKnitRepo(InterSameDataRepository):
518
"""Optimised code paths between Knit based repositories."""
521
def _get_repo_format_to_test(self):
522
return RepositoryFormatKnit1()
525
def is_compatible(source, target):
526
"""Be compatible with known Knit formats.
528
We don't test for the stores being of specific types because that
529
could lead to confusing results, and there is no need to be
533
are_knits = (isinstance(source._format, RepositoryFormatKnit) and
534
isinstance(target._format, RepositoryFormatKnit))
535
except AttributeError:
537
return are_knits and InterRepository._same_model(source, target)
540
def search_missing_revision_ids(self,
541
revision_id=symbol_versioning.DEPRECATED_PARAMETER,
542
find_ghosts=True, revision_ids=None, if_present_ids=None):
543
"""See InterRepository.search_missing_revision_ids()."""
544
if symbol_versioning.deprecated_passed(revision_id):
545
symbol_versioning.warn(
546
'search_missing_revision_ids(revision_id=...) was '
547
'deprecated in 2.4. Use revision_ids=[...] instead.',
548
DeprecationWarning, stacklevel=2)
549
if revision_ids is not None:
550
raise AssertionError(
551
'revision_ids is mutually exclusive with revision_id')
552
if revision_id is not None:
553
revision_ids = [revision_id]
555
source_ids_set = self._present_source_revisions_for(
556
revision_ids, if_present_ids)
557
# source_ids is the worst possible case we may need to pull.
558
# now we want to filter source_ids against what we actually
559
# have in target, but don't try to check for existence where we know
560
# we do not have a revision as that would be pointless.
561
target_ids = set(self.target.all_revision_ids())
562
possibly_present_revisions = target_ids.intersection(source_ids_set)
563
actually_present_revisions = set(
564
self.target._eliminate_revisions_not_present(possibly_present_revisions))
565
required_revisions = source_ids_set.difference(actually_present_revisions)
566
if revision_ids is not None:
567
# we used get_ancestry to determine source_ids then we are assured all
568
# revisions referenced are present as they are installed in topological order.
569
# and the tip revision was validated by get_ancestry.
570
result_set = required_revisions
572
# if we just grabbed the possibly available ids, then
573
# we only have an estimate of whats available and need to validate
574
# that against the revision records.
576
self.source._eliminate_revisions_not_present(required_revisions))
577
return self.source.revision_ids_to_search_result(result_set)
580
InterRepository.register_optimiser(InterKnitRepo)